Setting up a Laravel project from scratch ensures you have a clean, optimized foundation. Below are the steps to get started:
Step 1: Install ComposerDownload and install Composer globally to manage Laravel dependencies.
Step 2: Install Laravel via ComposerRun
composer create-project laravel/laravel project-name in terminal.
Step 3: Configure .env FileCopy
.env.example to
.env and set your DB credentials.
Step 4: Generate Application KeyRun
php artisan key:generate to secure your app.
Step 5: Set PermissionsMake sure
storage/ and
bootstrap/cache are writable.
Step 6: Configure Virtual Host (Optional)Point your Apache/Nginx to
public/ directory.
Step 7: Run Laravel Development ServerUse
php artisan serve to start local server.
Step 8: Migrate Default TablesRun
php artisan migrate to set up default DB tables.
Step 9: Set Up Git (Optional)Initialize git and push to a remote repository.
Step 10: Test ApplicationVisit
http://127.0.0.1:8000 to check your setup.