Code to install new laravel via cmd
To install a new Laravel project via the command line, you can use the following command:
composer create-project --prefer-dist laravel/laravel project-name
Replace project-name
with the name you want to give your project.
Here's a breakdown of the command:
composer
: This is the command-line tool for installing and managing PHP packages.create-project
: This is the command for creating a new project.--prefer-dist
: This option tells Composer to download the package in its most recent distribution (i.e., the latest version).laravel/laravel
: This is the package name for the Laravel framework.project-name
: This is the name of the project you want to create.
When you run this command, Composer will download the Laravel framework and create a new project with the specified name. The project will be created in a new directory with the same name.
For example, if you run the command composer create-project --prefer-dist laravel/laravel my-new-project
, Composer will create a new directory called my-new-project
with the Laravel framework installed.
Note: Make sure you have Composer installed on your system and that you are running the command in a directory where you have write permissions.