drupal 8 installation through composer code example
Example 1: composer drupal install
composer create-project drupal/recommended-project my_site_name_dir
Example 2: download specific version of drupal using composer
composer create-project drupal-composer/drupal-project:8.x-dev my_site_name_dir --no-interaction --no-install