Composer is a nifty tool that helps you manage Drupal and all its associated parts (modules, themes, libraries). Before diving in, be certain you have composer installed on your computer.
When using Drupal 10, it's wise to use the composer template found at drupal/recommended-project. This template ensures that Drupal Core dependencies are the exact same version as the official Drupal release. There are alternative methods, but this one is top-notch.
Initiate a project
composer create-project drupal/recommended-project my_site_name_dir
Doing this creates a project in 'my_site_name_dir' and automatically runs composer install
to fetch the newest stable version of Drupal and all its dependencies.
Note that your 'my_site_name_dir' will house files that should be kept outside of your web root, away from the prying eyes of the web server. The web root will be 'my_site_name_dir/web'.
Composer installation via Docker
If you're employing a Docker-based workflow, you might not have composer and its dependencies installed yet. In that case, use the following command to create your Drupal project:
docker run --rm -i --tty -v $PWD:/app composer create-project drupal/recommended-project my_site_name_dir --ignore-platform-reqs
Set up Drupal using the standard web interface
Once composer has finished downloading the necessary packages, simply direct your browser to your site's URL and kick off the setup. You'll be prompted for database credentials, an admin user name, and some basic info.
Get Drupal up and running through the command line
Drush allows you to install Drupal from the command line. To add Drush to your project, type: composer require drush/drush
and then use drush site:install to launch the command line setup wizard. Without any arguments, it will install the standard profile and only ask for your database credentials.
drush site:install