Drupal Watcher Adds Targeted Drush Cache Clears for Local Development
Developers working on Drupal projects can install irving-frias/drupal-watcher, a development-only Composer package from Irving Frias, a senior Drupal developer, that watches custom modules and themes and runs targeted Drush cache-clear commands after file changes.
The tool addresses a common local-development problem: repeated full cache rebuilds after routine edits. In a LinkedIn post, Irving framed Drupal Watcher as an alternative to running drush cr after every file save. Rather than running a full rebuild each time, the package maps changed file types to narrower cache-clear commands where possible.
As of 2 July 2026, Packagist lists version 1.2.79 of the package as published on 30 June 2026 at 21:49 UTC. The package page lists PHP 8.1+ as a requirement. The documentation also says Drush must be installed inside the Drupal project.
Package documentation says Drupal Watcher works with DDEV, Lando, and other local environments. Go is not required for normal Composer-based use because the binary is downloaded during Composer installation. The package is marked as a development tool and is intended to be installed with the Composer development dependency flag.
The default file-pattern mapping includes .html.twig and .twig files mapped to cc render, .theme files mapped to cc theme-registry, and .module, .inc, .php, and .yml files mapped to cc plugin. More specific YAML files, including .info.yml, .services.yml, .routing.yml, .permissions.yml, and .links.menu.yml, trigger cr. CSS and JavaScript files are mapped to cc css-js.
Before running Drush, the watcher can lint PHP and YAML files. The documentation says PHP files use php -l by default, while PHPCS can be enabled through the phpCsStandard setting. YAML files are checked with a Go YAML parser, and lint results are cached with a SHA-1 content hash and a five-minute TTL.
Changed files are grouped through a default debounce interval of 800 ms. Compatible cache-clear commands can be merged into a single Drush call, while changes requiring drush cr use a separate two-second lazy rebuild timer. The documentation describes these behaviours as development optimisations, but it does not provide independent benchmark results.
Drupal Watcher also includes a terminal user interface that shows file-change events, cache-clear results, errors, memory usage, and per-site activity. Multi-site support allows a single watcher process to run Drush commands across detected sites, provided aliases are configured through drush/sites.yml or drush/sites/{name}.site.yml. Site filtering is available through --site, --exclude-site, and --uri.
Installation uses composer require --dev irving-frias/drupal-watcher, followed by vendor/bin/drupal-watcher start from the Drupal project root. The package is intended for development environments and should remain excluded from production deployments through standard composer install --no-dev workflows.
More information is available from the Drupal Watcher GitHub repository and the Packagist package listing.
