Skip to content

Instantly share code, notes, and snippets.

@ajaxray
Created April 7, 2023 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajaxray/9e102157bac224dfeb49f93de7347f89 to your computer and use it in GitHub Desktop.
Save ajaxray/9e102157bac224dfeb49f93de7347f89 to your computer and use it in GitHub Desktop.
Start a Laravel Project with a sequence of commands

Starting a new Laravel app is easy and fast. You can do it just by running a couple of commands.

Notes:

  1. Choose sail services based on requirement
  2. I am using Larastarters. It's a Laravel Starter Kit with option to choose from a handful of Tailwind and Bootstrap themes.

Sequance of commands to start a laravel app

curl -s "https://laravel.build/ProjectName?with=mysql,redis,mailpit" | bash
cd ProjectName

# Setting 8009 port. Feel free to change 
sed -i '1s/^/APP_PORT=8009 3\n/' .env
# If you're on MacOS, run the following instead
# sed -i '' '1s/^/APP_PORT=8009 3\n/' .env

./vendor/bin/sail up -d
./vendor/bin/sail composer require laraveldaily/larastarters --dev
./vendor/bin/sail artisan larastarters:install
./vendor/bin/sail artisan migrate
# Your app is running...

See your brand new project running at http://localhost:8009.

Add the first user

To login to the new application, you'll need a user. You can use tinker tool to quickly add a new user in Laravel.

./vendor/bin/sail artisan tinker
# Run the following line with your choice of name, email and passowrd.
DB::table('users')->insert(['name'=>'admin','email'=>'admin@example.com','password'=> Hash::make('123123')])
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment