This course is archived!
This tutorial is built using Drupal 8.0. The fundamental concepts of Drupal 8 - like services & routing - are still valid, but newer versions of Drupal *do* have major differences.
03.
The Drupal Console & Route Cache
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
14 Comments
Running this on Drupal 9, few issues.
Mainly Drupal Console is not currently compatible with Drupal 9. See https://www.drupal.org/project/drupal/issues/3146509#comment-13679903
("Drupal Console is not yet compatible with Symfony 4, but Drupal 9 requires Symfony 4.")
So you can use Drush instead.
composer require drush/drushAfter downloading you have to run Drush as
vendor/drush/drush/drush(unless you get into Drush Launcher etc).To clear all caches use
vendor/drush/drush/drush crOr to just rebuild the routing table (as in the tutorial) you can run
vendor/drush/drush/drush ev '\Drupal::service("router.builder")->rebuild();'Sadly, the drupal console seems to be dead as one of the coauthors declared its development went on a hiatus. Community people advice using Drush instead. More on this here: https://www.drupal.org/proj...
Hey guys,
Thanks for sharing this info with others!
Cheers!
Hi, thank you for tutorial. I have a question.
Every time we change the route we have to reset router cache and run "drupal router: rebuild". But what to do when we put our module on the production site and there is no way to run drupal router: rebuild. What to do in such cases? I'm faced a problem that until I update the router cache, I can’t see the settings for my module on the configuration page. Clear all caches buttom from "admin/config/development/performance" doesn't help.
Hey Vyacheslav !
Good question. So, they "router:rebuild" is basically a way to only rebuild the routing cache... without rebuilding all your cache. And so, you should be able to rebuild the router cache by rebuilding all the caches. So, I'm actually surprised that the "Clear all caches" button isn't working... as that should clear all caches (including the router cache). Most commonly, this type of thing is handled via drush at deploy time - e.g.
drush cache-rebuild(which will clear all the caches, including routing cache).Do you use Drush at deploy? Or, how do you clear the "rest of your cache" on deploy - with the "Clear all caches" button?
Cheers!
Hello
I use windows. How can I install drupal console?
Hey Nina,
Check out this instruction for Windows users: https://hechoendrupal.gitbo...
Cheers!
Is it possible that this
curl https://drupalconsole.com/i... -L -o drupal.phar
mv console.phar /usr/local/bin/drupal
should be this?
curl https://drupalconsole.com/i... -L -o drupal.phar
mv drupal.phar /usr/local/bin/drupal
Yo Bert!
Yea, you're totally right! I just updated the code here: https://github.com/knpunive...
Thanks for pointing that out!
When I run "curl -LSs http://drupalconsole.com/in... | php" on Mac OS X 10.11.2 (El Captian) I get this error:
Warning: Phar::mapPhar(-): failed to open stream: No such file or directory in - on line 9
Fatal error: Uncaught exception 'PharException' with message 'unable to open phar for reading "-"' in -:9
Stack trace:
#0 -(9): Phar::mapPhar('console.phar')
#1 {main}
thrown in - on line 9
i have same problem too on ubuntu 15.10. what worked for me is execute
curl https://drupalconsole.com/i... -L -o drupal.phar
Looks http is not working for drupalconsole.com...
Wops. I said nothing. http redirects to https. but still don't work me with curl http...
Interesting! I just tried http and it works for me. I wonder if some curl versions don't handle the redirect correctly... I'll update the code at least to use https, which is of course better anyways :).
Thanks for the input!
you are very welcome. thanks for this courses. really like them.
Hi there!
Hmm, i'm not sure about this. Either your system had problems downloading the phar file (so just try it again), or there is some subtle system configuration that is somehow blocking the use of PHAR files. I don't see any issues on the DrupalConsole project (https://github.com/hechoend... for this, and as far as I can tell, it just seems like the installer file you downloaded with the curl command is corrupt. You should definitely not be having problems on a Mac - that's the most common development environment.
Cheers!
"Houston: no signs of life"
Start the conversation!