Laravel new

The laravel new command!

laravel new is a command-line tool provided by Laravel that allows you to create a new Laravel project from scratch. Here's a breakdown of the command and its options:

Basic Usage:

composer global require laravel/installer
laravel new project-name

Replace project-name with the desired name for your new Laravel project.

Options:

Example:

composer global require laravel/installer
laravel new my-laravel-project --directory=/path/to/project --force

This command will create a new Laravel project named my-laravel-project in the specified directory /path/to/project, overwriting any existing files or directories.

What happens when you run laravel new?

When you run laravel new, the following steps occur:

  1. The Laravel installer checks if you have Composer installed and sets up the project structure.
  2. It creates a new directory for the project and initializes the project with the Laravel framework.
  3. It installs the required dependencies using Composer.
  4. It sets up the project configuration files, such as composer.json, webpack.mix.js, and routes/web.php.
  5. It creates the basic project structure, including directories for controllers, models, views, and more.

After running laravel new, you'll have a brand new Laravel project ready to start building your application!