Drupal 8 : améliorons-la ! • Kind of the same concept than the User eXperience applied to development • The user is the developer • But we are more demanding • And the scope is larger
développeur dans Drupal 8 : améliorons-la ! • A basic and common need • Way too many steps for a new Drupal developer • It should be enabled from the start in local
dans Drupal 8 : améliorons-la ! • Hard to master • Lots of terms : internal, dynamic, Twig, render, keys, tags, context, max age • Even way harder to understand for the front developers
L’expérience développeur dans Drupal 8 : améliorons-la ! • You must clear a cache but you don’t know which one • So you clear all cache • Precious seconds wasted everytime
dans Drupal 8 : améliorons-la ! • D8DX: Improving the D8 developer experience https://www.drupal.org/community-initiatives/drupal-core/d8dx • List DX issues • Provide a common vocabulary
Drupal 8 : améliorons-la ! • Open source third party library • Improve your DX during the development process • Help you develop better and faster • Reuse well known and well tested open source components
dans Drupal 8 : améliorons-la ! • Global $config variable • Normally, you modify it in the settings.php file • The library just override everything after the settings initialization
dans Drupal 8 : améliorons-la ! • Settings class singleton • Normally, you modify it in the settings.php file • The library just override everything after the settings initialization
dans Drupal 8 : améliorons-la ! • Twig configuration is defined by parameters • Override those parameters before the container compilation • Twig cache is also disabled with this way
dans Drupal 8 : améliorons-la ! • Use Symfony HttpKernel component ExceptionListener • Use Symfony Debug component ExceptionHandler • Available after the environment boot, so very early
développeur dans Drupal 8 : améliorons-la ! • Use the Symfony Debug component DebugClassLoader class • Wrap your autoloader (a Composer ClassLoader instance most likely) • Also does lightweight static analysis when a class is loaded
développeur dans Drupal 8 : améliorons-la ! • PHP errors must be handled • Use the Symfony Debug Component ErrorHandler class • Set a custom error handler that rethrow PHP errors as exceptions
Drupal 8 : améliorons-la ! • A resources freshness checker system • A file resource is tied to an extension • A file cache system • A file backend cache system
- L’expérience développeur dans Drupal 8 : améliorons-la ! • Modules are handled too late in the boot • Some actions would be impossible to implement • It would need to be enabled on first use • It would need to be managed to not be used on production
L’expérience développeur dans Drupal 8 : améliorons-la ! • Create a copy of the DrupalKernel on the fly • Use another name • Replace paths references • Alias the DrupalKernel with our DebugKernel
développeur dans Drupal 8 : améliorons-la ! • The library works out of the box • The Debug Kernel is used by any third party library that woud normally use the Drupal Kernel
développeur dans Drupal 8 : améliorons-la ! • Compatibility problems • Disable it to test a behavior with caches enabled • Disable it for all your tests
Drupal 8 : améliorons-la ! • Some actions are configurable with options • Not mandatory because there are defaults values • Configuration is done in a YAML file • Some with environment variables