Share this page
Back

How to Set Up a Laravel Project from Scratch

Setting up a Laravel project from scratch ensures you have a clean, optimized foundation. Below are the steps to get started:

Step 1: Install Composer
Download and install Composer globally to manage Laravel dependencies.

Step 2: Install Laravel via Composer
Run composer create-project laravel/laravel project-name in terminal.

Step 3: Configure .env File
Copy .env.example to .env and set your DB credentials.

Step 4: Generate Application Key
Run php artisan key:generate to secure your app.

Step 5: Set Permissions
Make 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 Server
Use php artisan serve to start local server.

Step 8: Migrate Default Tables
Run 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 Application
Visit http://127.0.0.1:8000 to check your setup.