How to create a 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. Here are some examples:
--prefer-dist
: This option tells Composer to download the Laravel package in a compressed format, which can save time and disk space.--dev
: This option tells Composer to install the Laravel development dependencies, which include tools like Laravel Debugbar and Laravel Telescope.--no-ansi
: This option tells Composer to not install the Laravel ansi color output package.--no-interaction
: This option tells Composer to not prompt you for any input during the installation process.
For example, to create a new Laravel project with the development dependencies and without ansi color output, you can run the following command:
composer create-project --prefer-dist --dev --no-ansi laravel/laravel project-name