Laravel new command
The laravel new
command!
The laravel new
command is used to create a new Laravel project. Here's the basic syntax:
composer create-project --prefer-dist laravel/laravel project-name
Replace project-name
with the desired name of your new Laravel project.
Here's a breakdown of the options:
composer
: This is the command-line tool for managing dependencies in PHP projects.create-project
: This is the command to create a new project.--prefer-dist
: This option tells Composer to download the project in its most optimized form, which is faster and more efficient.laravel/laravel
: This is the package name for the Laravel framework.project-name
: This is the name of the new project.
When you run this command, Composer will download the Laravel framework and its dependencies, and then create a new project directory with the specified name. The project directory will contain the basic structure for a Laravel project, including the app
, config
, database
, public
, resources
, and tests
directories.
Here's an example of what the output might look like:
$ composer create-project --prefer-dist laravel/laravel my-new-project
Creating a "laravel/laravel" project at./my-new-project
Installing laravel/laravel (v8.40.0)
- Installing laravel/laravel (v8.40.0): Downloading (100%)
Created project directory `my-new-project` successfully.
That's it! You now have a brand new Laravel project ready to go.