Making the phpstan-drupal playground work for agents
The phpstan-drupal playground exists to reproduce bugs. You paste PHP, run PHPStan with phpstan-drupal against a real Drupal core install, and share the result link in an issue.
A deep, practical tour through every caching layer in Drupal — from the render cache to chained fast backends.
Get it on LeanPub
The phpstan-drupal playground exists to reproduce bugs. You paste PHP, run PHPStan with phpstan-drupal against a real Drupal core install, and share the result link in an issue.
phpstan-drupal 2.1.0 is out. The theme of this release: rules and behaviors that proved themselves as opt-ins are now the defaults. If you run `composer update` and see new errors, that is the release working as intended — everything below includes the configuration to opt back out.
Drupal's config schema YAML supports dynamic expressions inside square brackets that resolve to values from the surrounding configuration data at runtime. Most developers have seen them — [%parent.type] in field formatter schema is a classic example — but few understand exactly how they work or when to use them.
Drupal's cache.backend.chainedfast makes your site faster without any configuration. All you need is to have APCu on your server. It shows up in the bootstrap, config, and discovery cache bins, and most developers never think about it or even know it is being leveraged.
When making code changes or fixing issues, it's easy to leave @todo comments behind. Sometimes they mark areas waiting on an upstream fix, sometimes they're reminders that never got revisited. Either way, they accumulate — and the ones tied to the specific issue you're working on should be resolved before the MR merges.
After starting in early 2023 and having a long hiatus from writing, my book Understanding Drupal: A Complete Guide to Caching Layers is now published on LeanPub! Three years ago (😱), I started working on this book that I wanted to self-publish.
Drupal's role-based access control is one of its strengths. Permissions and roles are well-understood, and the system is mature. But the moment you step outside the standard cookie-based session — say, into OAuth with the authorization code flow — you hit a wall that the core permission model never anticipated.
By default, drush updb clears the cache after applying database updates. For deployments where you want to avoid an unnecessary performance hit, you can prevent this default behavior using a Drush pre-command hook. The updb command has a --cache-clear flag that you can set up in your CI workflow, but what about local testing?