A basic walk-through of setting up a new Laravel project.
There are two methods of setting up a new Laravel project:
You can use composer to simply download a new project scaffolding:
composer create-project laravel/laravel example-appThis is a simple method that only requires the installation of Composer. This command will work on both a Windows maching or a Mac.
Or you can install the Laravel installer and use it to set up new Laravel scaffolding:
composer global require laravel/installer
laravel new example-app
cd example-app
php artisan serveThis will create a new Laravel application scaffolding in a folder names example-app and deploy the application using Artisan (the command line interface included with Laravel).
You can also deploy the new Laravel application using a tool such as MAMP by pointing the root directory to example-app/public.
Once you have the Laravel installer installed, you will want to add it to your PATHS, so it is accessible from any folder using the command line. This is done slightly different on a Windows maching and a MAc:
If you are using Windows, follow these steps:
-
Open up the Comman Prompt
-
Run the following commane:
pathman /ru c:\Users\[Your User]\AppData\Roaming\Composer\vendor\bin
-
YOu can then run the command
echo %PATH%to see a list of all current folders included.
If you are using a Mac, follow these steps:
-
Open the Terminal
-
Open the paths file using VIM:
sudo vim /etc/paths
-
Push the
okey. This will insert a new line and change to insertion mode. -
Add the path to the Laravel installer to your paths file:
/Users/Adam/.composer/vendor/bin
-
Push
ESC, this will exit insertion mode. -
Type
:wq, this will save an exit.
You are now ready to create a new Laravel project. Open your command line tool, navigate to the folder you want to place the new project in, and then run the following command:
laravel new example-appFull tutorial URL:
https://codeadam.ca/learning/laravel-installer
