Install drupal using composer

First we have to check the requirement for drupal version. For example, drupal 9 need this requirement:-

PHP: PHP 7.3 or higher
APACHE: Apache 2.4.7 or higher
DATABASE:

  • MySQL or Percona 5.7.8.
  • MariaDB 10.3.7 (Note that this is a more recent release than the MySQL version.)
  • PostgreSQL 10 with the pg_trgm extension.
  • SQLite 3.26 (PHP does not always use the system-provided SQLite, so verify that your PHP is compiled with at least this version).

Step:-

1) When above requirement satisfy, we start install drupal and all depencies by run code below:-
composer create-project drupal/recommended-project my_site_name_dir
Note:  'my_site_name_dir' is the drupal site folder name (Change the name according to our preference)

After that, composer start to install drupal site & all dependencies

2) Create a database:

  • Open Xampp (For this example - say that we are using Xampp in localhost)
  • Type: localhost/phpmyadmin
  • Create the database

3) Open the drupak site: localhost/yourdrupalsitename/web

4) Setup drupal site begun..just fill up the info acoordingly
     put your database name, database username (root) & password (leave it blank - if you not setting the password)

5) Done..