PHP Packages as Drupal Extensions
PHP Packages as Drupal Extensions
Fabian Bircher (Bircher)
Drupal has three types of extensions: modules, themes and profiles. Each serves their own purpose. Drupal extensions implement hooks, event subscribers and add services to the Drupal service container to extend Drupal. But unlike regular php packages/libraries the familiar Drupal extensions need to be installed before they can be used.
What if there was a way to have drupal extensions that are available if they exist in the codebase? Composer require a package and the dr command it provides is there before the Drupal site is even installed.
This would make it much easier to replace parts of an installation profile for example.
There would probably be some restrictions of course! These drupal package extensions would have to be stateless, no install hooks, no update hooks, no schema hooks etc.
It is already possible to achieve this in a drupal project by adding things to settings.php but that approach is not very scalable or user friendly.
Help flesh out the idea.