improve your developer experience • 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
Debug: improve your developer experience • Thomas Calvet - fancyweb • 6 years experience in PHP • Long time Symfony user and enthusiast • New Drupal developer
Drupal Debug: improve your developer experience • A basic and common need • Way too many steps for a new Drupal developer • It should be enabled from the start in local
Debug: improve your developer experience • Hard to master • Lots of terms : internal, dynamic, Twig, render, keys, tags, context, max age • Even way harder to understand for the front developers
- Drupal Debug: improve your developer experience • You must clear a cache but you don’t know which one • So you clear all cache • Precious seconds wasted everytime
Debug: improve your developer experience • D8DX: Improving the D8 developer experience https://www.drupal.org/community-initiatives/drupal-core/d8dx • List DX issues • Provide a common vocabulary
improve your developer experience • 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
Debug: improve your developer experience • Global $config variable • Normally, you modify it in the settings.php file • The library just overrides everything after the settings initialization
Debug: improve your developer experience • Settings class singleton • Normally, you modify it in the settings.php file • The library just overrides everything after the settings initialization
Debug: improve your developer experience • Twig configuration is defined by parameters • Override those parameters before the container compilation • Twig cache is also disabled with this way
Debug: improve your developer experience • Use Symfony HttpKernel component ExceptionListener • Use Symfony Debug component ExceptionHandler • Available after the environment boot, so very early
Drupal Debug: improve your developer experience • 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
Drupal Debug: improve your developer experience • PHP errors must be handled • Use the Symfony Debug Component ErrorHandler class • Set a custom error handler that rethrow PHP errors as exceptions
improve your developer experience • A file resource is tied to an extension (a module or a theme) • A resources freshness checker system • A file cache system • A file backend cache system
Transylvania - Drupal Debug: improve your developer experience • 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
- Drupal Debug: improve your developer experience • Create a copy of the DrupalKernel on the fly • Use another name • Replace __DIR__ references • Alias the DrupalKernel with our DebugKernel
Drupal Debug: improve your developer experience • The library works out of the box • The Debug Kernel is used by any third party library that woud normally use the Drupal Kernel
Drupal Debug: improve your developer experience • Compatibility problems • Disable it to test a behavior with caches enabled • Disable it for all your tests
improve your developer experience • Some actions are configurable with options • Not mandatory because there are defaults values • Configuration is done in a YAML file • Some with environment variables
Developer Days Transylvania 2019 website: https://cluj2019.drupaldays.org/schedule Take the survey! https://www.surveymonkey.com/r/drupaltransylvania THANK YOU!