create a new laravel project with composer code example

Example 1: create laravel 6 project using composer

composer create-project --prefer-dist laravel/laravel blog "6.*"

Example 2: composer create project laravel 7

composer create-project --prefer-dist laravel/laravel:^7.0 blog

Example 3: laravel create project

// To install and use a specific version, you can enter it at the end of the command.
// For example using version 5.8 ==>
composer create-project --prefer-dist laravel/laravel projectName "5.8.*"

Example 4: create project command in laravel

Before starting this hope you installed composer dependancy manager for PHP.
----------------------------------------------------------------------------- 
So if you want to create a project by name of 'first_laravel_app' in directory C:/xampp/htdocs/ then what you need to do is

Locate your project parent directory using cmd
>cd c:/xampp/htdocs

and fire this command 
>composer create-project laravel/laravel first_laravel_app --prefer-dist

And its done, this is really easy and it also creates Application Key automatically for you.
  
# I hope it will help you.
# Namaste

Example 5: laravel instal

composer global require laravel/installer

laravel new example-app

php artisan serve