How to create new laravel project
To create a new Laravel project, you can use the Laravel installer, which is a command-line tool that helps you create a new Laravel project with ease. Here are the steps:
Method 1: Using the Laravel Installer
-
Open your terminal or command prompt.
-
Run the following command to install the Laravel installer:
composer global require laravel/installer
-
Once the installer is installed, navigate to the directory where you want to create your new Laravel project.
-
Run the following command to create a new Laravel project:
laravel new project-name
Replace
project-name
with the name of your project. -
The installer will create a new directory with the name you specified, and inside that directory, it will create the basic structure for a Laravel project.
-
You can then navigate into the project directory and start building your application.
Method 2: Using Composer
-
Open your terminal or command prompt.
-
Run the following command to create a new Laravel project using Composer:
composer create-project --prefer-dist laravel/laravel project-name
Replace
project-name
with the name of your project. -
The command will create a new directory with the name you specified, and inside that directory, it will create the basic structure for a Laravel project.
-
You can then navigate into the project directory and start building your application.
Additional Options
When creating a new Laravel project, you can also specify additional options to customize the project. For example:
--prefer-dist
: This option tells Composer to download the Laravel package in a compressed format, which can save time and bandwidth.--dev
: This option tells Composer to install the Laravel development dependencies, which includes tools like Laravel Debugbar and Laravel Telescope.--no-ansi
: This option tells Composer to not install the Laravel ansi color output package.
Here are some examples of how you can use these options:
laravel new project-name --prefer-dist --dev
composer create-project --prefer-dist laravel/laravel project-name --dev --no-ansi