How do you create a new Laravel project?
Creating a new Laravel project is pretty straightforward. Here's a step-by-step guide:
-
Install Composer: Laravel uses Composer to manage its dependencies. If you don’t have Composer installed, you can download and install it from getcomposer.org.
-
Install Laravel Installer (Optional): This is a global Composer package that helps in creating Laravel projects.
composer global require laravel/installer -
Create a New Laravel Project:
- Using Laravel Installer:
laravel new project-name - Using Composer:
composer create-project --prefer-dist laravel/laravel project-name
- Using Laravel Installer:
-
Navigate to Your Project Directory:
cd project-name -
Set Up Your Environment:
- Copy the
.env.examplefile to create a.envfile.cp .env.example .env - Generate the application key.
php artisan key:generate
- Copy the
-
Run the Development Server:
php artisan serveBy default, this will serve your application at
http://localhost:8000.
That’s it! You now have a new Laravel project up and running.
Your Feedback
Help us improve by sharing your thoughts
Online Learner helps developers master programming, database concepts, interview preparation, and real-world implementation through structured learning paths.
Quick Links
© 2023 - 2026 OnlineLearner.in | All Rights Reserved.
