install drupal console on windows 10 with composer

Install Drupal Console on Windows with Composer


I was trying to enable development mode on my Drupal 9 site on my localhost and I found Drupal console an easy way to enable dev mode for Drupal 9 theme development environment. While installing Drupal console, I faced difficulties that’s why I am writing this post. Just to let you know that I am using Windows 10 with XAMMP server with PHP 8.1. I also have installed Composer on my system.

  1. Install XAMPP on Windows 10
  2. Install Composer on Windows
  3. Install Drupal on Windows

Let’s see how to Install Drupal Console on Windows 10 with Composer.

Launch your command prompt, also make sure your local server is running and your Drupal site is installed and loading page normally.

Navigate to Drupal Installation Folder

cd /
cd xampp\htdocs\d9

Install Drupal Console with Composer

Run the following command to add drupal console to your current Drupal site.

composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
y

Check if Drupal Console is Installed

From drupal site installation directory, run the following command to check the Drupal site status.

vendor\bin\drupal site:status

Drupal Site Dev Mode and Prod Mode

Using these following commands you can put your Drupal site in development mode and put it back in production mode.

vendor\bin\drupal site:mode dev
vendor\bin\drupal site:mode prod
drupal console check status command