I have created two fresh installations of Drupal, one version 8.9.17 and the other 9.2.3 and have been trying to get the Drupal console to work so that I can generate a module.
I used the following command in Composer and successfully downloaded it.
composer require drupal/console:~1.0 \
--prefer-dist \
--optimize-autoloader \
--sort-packages \
--no-update
Then run the following to avoid a Symphony conflict error.
composer update
This downloaded the relevant files and dependencies but when I try to access it from the command line (see below)
$ ../../../../vendor/bin/drupal
I get the following error.
Warning: require(drupal.php): failed to open stream: No such file or
directory in C:\xampp\htdocs\project_name\vendor\bin\drupal(21) :
eval()'d code on line 3 PHP Fatal error: require(): Failed
opening required 'drupal.php' (include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\project_name\vendor\bin\drupal(21) : eval()'d code on line
3
Fatal error: require(): Failed opening required 'drupal.php'
(include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\project_name\vendor\bin\drupal(21) : eval()'d
code on line 3
I looked on the Drupal console website and the advice was
This can be caused by the ioncube loader extension
As i'm working with Xammp on Windows 10, ioncube isn't available by default in the php.ini file. What should I be looking for to solve this?
EDIT
It has been pointed out to me that Drush now includes generating commands and should be used instead of Drupal console which appears to be obsolete.