The following needs to be done before you install Laravel.
Make sure you've got the bash aliases added. To add them, open ~/.bashrc (nano ~/.bashrc or code ~/.bashrc) and paste them at the top or bottom, anywhere is find. I prefer the top.
Here's the alias to use sail ....
alias sail='sh $([ -f sail ] && echo sail || echo vendor/bin/sail)'Now, to make life a bit easier, I've also got the following just for ease of use. These will allow you to type normal composer ... and php artisan ... commands without having to use sail ... before each command.
alias composer='sh $([ -f sail ] && echo "sail composer" || echo "vendor/bin/sail composer")'
alias artisan='sh $([ -f sail ] && echo "sail artisan" || echo "vendor/bin/sail artisan")'
alias npm='sh $([ -f sail ] && echo "sail npm" || echo "vendor/bin/sail npm")'So instead of using a command such as sail composer install ... you can just use composer install .... The same goes for sail artisan make:model ModelName, you can just use artisan make:model ModalName. Again, npm is the same as well. Instead of sail npm run dev, you can just type npm run dev.
And the newest alias I have is the following:
alias installlaravel='curl -s "https://laravel.build/app-name?with=mysql" | bash'That one isn't too important, but if you're installing projects over and over, it makes life a bit easier. Next time you need a new laravel application, just create a new folder and type installlaravel and boom. Laravel is now installed with MySQL.
If you plan on using more than MySQL on every project, you can update the above with whatever services you'd like.
alias installlaravel='curl -s "https://laravel.build/app-name?with=mysql,redis,mailpit" | bash'Tip
You can change app-name to the name of your app. This will change the name of the folder your laravel application is installed in.
Now that's out of the way, let's get down to business.
To install Laravel (without using installlaravel command), you can just paste the following:
curl -s "https://laravel.build/app-name?with=mysql" | bashNote
Be sure to add whatever services you want.
Example: ...app-name?with=mysql,redis,mailpit
Note
Also, don't forget to change the app-name to the name of your application.
After a few mins (it does take some time), you should have a fully working application.