Create new laravel project composer
To create a new Laravel project using Composer, follow these steps:
Step 1: Install Composer
If you haven't already, download and install Composer from the official website: https://getcomposer.org/
Step 2: Create a new project
Open your terminal and run the following command:
composer create-project --prefer-dist laravel/laravel project-name
Replace project-name
with the desired name of your project.
Step 3: Navigate to the project directory
Change into the newly created project directory:
cd project-name
Step 4: Initialize the project
Run the following command to initialize the project:
composer install
This command will install all the required dependencies for your Laravel project.
Step 5: Set up the environment
Run the following command to set up the environment:
php artisan key:generate
This command will generate a random encryption key for your project.
Step 6: Start the development server
Run the following command to start the development server:
php artisan serve
This command will start the development server, and you can access your project at http://localhost:8000
That's it! You now have a brand new Laravel project set up and ready to go.
Note: You can also use the composer create-project
command with the --dev
option to create a development environment:
composer create-project --prefer-dist --dev laravel/laravel project-name
This will create a development environment with the necessary dependencies and configurations for development.