{"id":20364130,"url":"https://github.com/ekino/drupal-debug","last_synced_at":"2025-12-30T08:03:30.088Z","repository":{"id":56976119,"uuid":"154120537","full_name":"ekino/drupal-debug","owner":"ekino","description":"Alternative Kernel for Drupal 8 to improve the Developer eXperience during the development process.","archived":true,"fork":false,"pushed_at":"2020-05-06T08:31:35.000Z","size":345,"stargazers_count":31,"open_issues_count":16,"forks_count":8,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-12-14T18:52:24.572Z","etag":null,"topics":["debug","developer-experience","drupal"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ekino.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-22T09:49:07.000Z","updated_at":"2025-01-02T13:04:31.000Z","dependencies_parsed_at":"2022-08-21T07:40:33.898Z","dependency_job_id":null,"html_url":"https://github.com/ekino/drupal-debug","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ekino/drupal-debug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fdrupal-debug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fdrupal-debug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fdrupal-debug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fdrupal-debug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ekino","download_url":"https://codeload.github.com/ekino/drupal-debug/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fdrupal-debug/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28124749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-30T02:00:05.476Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debug","developer-experience","drupal"],"created_at":"2024-11-15T00:09:58.213Z","updated_at":"2025-12-30T08:03:29.682Z","avatar_url":"https://github.com/ekino.png","language":"PHP","readme":"# Drupal Debug\n\n[![Build Status](https://travis-ci.org/ekino/drupal-debug.svg?branch=master)](https://travis-ci.org/ekino/drupal-debug)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ekino/drupal-debug/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/ekino/drupal-debug/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/ekino/drupal-debug/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/ekino/drupal-debug/?branch=master)\n\n------\n\nThis library provides an alternative Kernel for Drupal 8 to improve the Developer eXperience during the development process.\n\nThis Debug Kernel extends (but substitutes entirely by default) the original Drupal Kernel in order to alter some inner Drupal behaviors.\nIt is done for one reason: help you develop better and faster!\n\nOnce this library is installed, you will be able to experience a « debug mode » during the development process.\nFor example, you will not need to manually clear the cache anymore when you add or remove a custom service, a route or a module hook implementation.\n\n# Requirements\n\nThis library requires that your Drupal project uses [Composer](https://getcomposer.org/). If it is not the case yet, you can check [this Composer template for Drupal projects](https://github.com/drupal-composer/drupal-project\n) for example.\n\nIt has active support for the [latest released Drupal minor version](https://www.drupal.org/project/drupal/releases) only.\n\nIt has active support for the [currently supported versions of PHP](http://php.net/supported-versions.php) only.\n\n# Installation\n\nRequire this library as a development dependency.\n\n```\ncomposer require ekino/drupal-debug --dev\n```\n\nIt **MUST** only be installed as a development dependency. You do not want to use it in production!\n\n# Actions\n\nThis library works with « actions ».\nAn action has an unique goal that improves your development experience with Drupal.\n\nAt the moment, all actions are enabled and mandatory but the plan is to make most of them optional, step by step.\n\nAlso, you cannot provide your own custom actions yet but this is planned for the future as well.\n\nHere is the list of the current available actions and how they help you:\n\n| Name                               | Description                                                                                                                                                            |\n| ---------------------------------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Disable CSS Aggregation            | Disable CSS files aggregation                                                                                                                                          |\n| Disable Dynamic Page Cache         | Disable [Drupal Dynamic Page Cache](https://www.drupal.org/docs/8/core/modules/dynamic-page-cache)                                                                     |\n| Disable Internal Page Cache        | Disable [Drupal Internal Page Cache](https://www.drupal.org/docs/8/administering-a-drupal-8-site/internal-page-cache)                                                  |\n| Disable JS Aggregation             | Disable JS files aggregation                                                                                                                                           |\n| Disable Render Cache               | Disable [Drupal Render Cache](https://www.drupal.org/docs/8/api/render-api/cacheability-of-render-arrays)                                                              |\n| Disable Twig Cache                 | Disable Twig Cache                                                                                                                                                     |\n| Display Dump Location              | Display location when you use the `dump()` function of the Symfony VarDumper component                                                                                 |\n| Display Pretty Exceptions          | Display a better looking exception page and log exceptions (active when the `Request` is handled by the Kernel and if the exceptions are caught)                       |\n| Display Pretty Exceptions ASAP     | Display a better looking exception page (active as soon as the Kernel is instantiated)                                                                                 |\n| Enable Debug Class Loader          | Enable the `DebugClassLoader` of the Symfony Debug component                                                                                                           |\n| Enable Twig Debug                  | Enable Twig Debug mode                                                                                                                                                 |\n| ~~Enable Twig Strict Variables~~   | ~~Enable Twig `strict_variables` option~~ (disabled at the moment because the [Drupal core is not ready](https://www.drupal.org/project/drupal/issues/2445705) at all) |\n| Throw Errors As Exceptions         | Throw PHP errors as exceptions                                                                                                                                         |\n| Watch Container Definitions        | Watch services definitions and service providers files to automatically invalidate the container definition                                                            |\n| Watch Modules Hooks Implementations| Watch `.module` files to automatically refresh the modules hooks implementations                                                                                       |\n| Watch Routing Definitions          | Watch routing definitions files to automatically rebuild the routes                                                                                                    |\n\nAnd more to come!\n\n# Configuration\n\nSome actions are configurable with options that can be set in a dedicated configuration file.\nHowever, this configuration file is not mandatory because every option has a default value that is resolved if it is not explicitly defined.\n\nAt the moment, those options are not configurable independently for each action (with this file) but this is of course planned.\nWhat is configurable is actually the defaults values of reused options.\nIf you want to specify options for each actions, you have to [manually use the Debug Kernel](#manually-use-the-debug-kernel).\n\nHere is the default configuration file content (i.e. the default resolved configuration if the configuration file does not exist, or if a key is not defined):\n```yaml\n# This is the drupal-debug configuration file.\ndrupal-debug:\n\n    # The defaults values are common values that are reused by different actions.\n    defaults:\n        cache_directory_path: cache\n        logger:\n            enabled: true\n            channel: drupal-debug\n            file_path: logs/drupal-debug.log\n        charset: null\n        file_link_format: null\n\n    # It is recommended to disable the original Drupal Kernel substitution to run your tests.\n    # To programmatically toggle it, use the two dedicated composer commands.\n    substitute_original_drupal_kernel:\n        enabled: true\n        composer_autoload_file_path: vendor/autoload.php\n\n        # If not specified, it fall backs to the default cache directory path.\n        cache_directory_path: null\n```\n\nBy default, the location of this configuration file is the root of the project (the parent directory of the Composer vendor directory).\nBut it can be defined with the `DRUPAL_DEBUG_CONFIGURATION_FILE_PATH` environment variable.\n\nFor performance, the resolved configuration is cached.\nBy default, the location of this cache is the system temporary directory.\nBut it can be defined with the `DRUPAL_DEBUG_CONFIGURATION_CACHE_DIRECTORY_PATH` environment variable.\n\nHere is the list of all the actions that have options :\n\n#### Display Pretty Exceptions\n* charset:  The charset of the exception page.\n* fileLinkFormat: The file link format used to create links to your IDE.\n* logger: A `LoggerInterface` instance to log exceptions.\n\n#### Display Pretty Exceptions ASAP\n* charset: The charset of the exception page.\n* fileLinkFormat: The file link format used to create links to your IDE.\n\n#### Throw Errors As Exceptions\n* levels: Required. The bit field of E_* constants for thrown errors.\n* logger: A `LoggerInterface` instance to log errors.\n\n#### Watch Container Definitions\n* cacheFilePath: Required. The location of the cached container definition file.\n* resourcesCollection: Required. An `ResourcesCollection` instance (the resources to watch).\n\n#### Watch Modules Hooks Implementations\n* cacheFilePath: Required. The location of the cached modules hooks implementations file.\n* resourcesCollection: Required. An `ResourcesCollection` instance (the resources to watch).\n\n#### Watch Routing Definitions\n* cacheFilePath: Required. The location of the cached routing file.\n* resourcesCollection: Required. An `ResourcesCollection` instance (the resources to watch).\n\n# Composer commands\n\nHere is the list of the provided Composer commands that help you manage the configuration file:\n\n| Command                                                           | Alias                         | Description                                                                     |\n| ----------------------------------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------- |\n| composer drupal-debug:dump-reference-configuration-file           | None                          | Dump the reference configuration file                                           |\n| composer drupal-debug:disable-original-drupal-kernel-substitution | composer drupal-debug:disable | Alter the configuration file to disable the original Drupal Kernel substitution |\n| composer drupal-debug:enable-original-drupal-kernel-substitution  | composer drupal-debug:enable  | Alter the configuration file to enable the original Drupal Kernel substitution  |\n\n# Original Drupal Kernel substitution\n\nSubstituting the original Drupal Kernel concretely means that every time the `DrupalKernel` class is used somewhere after the Composer autoload file has been required, it is this library `DebugKernel` class that is actually being used, despite appearances!\n\nIt is great because any third party libraries interacting with Drupal (such as `drush` for example) will automatically use the Debug Kernel.\n\nHowever, it could lead to unwanted behaviors, especially during the WIP phase of this library.\nThis is why you **SHOULD NOT** use the original Drupal Kernel substitution when you run your tests for example. Keep it for the development part only!\n\n# Manually use the Debug Kernel\n\nIt is possible to directly use the Debug Kernel in your front controller (typically the `index.php` file in your web exposed directory) to specify options for each actions.\nIt is also the solution to use the Debug Kernel with the original Drupal Kernel substitution disabled.\n\nYou simply need to use the `OptionsStackBuilder` helper class to build an `OptionsStack` instance and pass it to the `DebugKernel` constructor.\n\nManually setting an option in the options stack overrides the default value defined by the configuration (if it exists).\n\nHere is an example usage:\n```php\n\u003c?php\n\n/**\n * @file\n * The PHP page that serves all page requests on a Drupal installation.\n *\n * All Drupal code is released under the GNU General Public License.\n * See COPYRIGHT.txt and LICENSE.txt files in the \"core\" directory.\n */\n\nuse Ekino\\Drupal\\Debug\\Kernel\\DebugKernel;\nuse Ekino\\Drupal\\Debug\\Option\\OptionsStackBuilder;\nuse Ekino\\Drupal\\Debug\\Resource\\Model\\ResourcesCollection;\nuse Symfony\\Component\\Config\\Resource\\FileResource;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\n$optionsStack = OptionsStackBuilder::create()\n  -\u003esetDisplayPrettyExceptionsOptions('utf-8', 'phpstorm://open?file=%%f\u0026line=%%l', NULL)\n  -\u003esetWatchContainerDefinitionsOptions('/tmp/container_definition.php', new ResourcesCollection([\n    new FileResource('/var/www/my_drupal_project/web/modules/custom_module/custom_module.services.yml'),\n  ]))\n  -\u003egetOptionsStack();\n\n$autoloader = require_once 'autoload.php';\n\n$kernel = new DebugKernel('prod', $autoloader, TRUE, NULL, $optionsStack);\n\n$request = Request::createFromGlobals();\n$response = $kernel-\u003ehandle($request);\n$response-\u003esend();\n\n$kernel-\u003eterminate($request, $response);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekino%2Fdrupal-debug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekino%2Fdrupal-debug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekino%2Fdrupal-debug/lists"}