stadline/execution-cache-bundle
Symfony bundle for caching the results of expensive executions so repeated calls reuse stored output instead of recomputing it. Configure cache adapters and lifetimes to speed up heavy service or method calls.
The 0.2.0 release is the first version with a usable on-ramp: bundle configuration, annotation support, and documentation all landed together. Start with the docs rather than the source — this package is pre-1.0 and the README is now the most reliable description of intended usage.
Minimal steps:
composer require <vendor>/<package>:0.2.0 — pin the exact version. At 0.x a minor bump can be breaking, and 0.2.0 already reshapes how configuration is expressed.php artisan vendor:publish --provider="Vendor\Package\PackageServiceProvider"
Expect a config/<package>.php file. This is the main artefact of the "bundle configuration" feature — bundles are declared there rather than being hardcoded or auto-discovered implicitly.// config/<package>.php
return [
'bundles' => [
'app' => [
'path' => app_path(),
// package-specific options
],
],
];
If the annotation syntax is attribute-based (PHP 8 #[...]) rather than docblock, prefer attributes — they are refactor-safe and IDE-navigable, and docblock scanning is the more expensive of the two.
Config-first bundle definition. Treat config/<package>.php as the single source of truth for what the package knows about. Per-environment overrides belong in .env values read inside the config file, not in conditional logic scattered through service providers. This keeps config:cache viable in production, which is the whole point of a config-driven bundle registry.
One bundle per domain, not per directory. Because bundles are now an explicit configuration concept, the natural mistake is mapping them 1:1 to folders. Map them to cohesive units instead (e.g. billing, catalog), so annotation-driven resolution has a meaningful scope to search within.
Annotations as declarative glue. The intended pattern is: annotate a class to mark it as belonging to a bundle or exposing some behaviour, and let the package resolve it at boot rather than registering each one by hand. Keep annotated classes side-effect free in their constructors — they may be instantiated during discovery before you expect it.
Integration tip. Register the package service provider normally, then do your own customisation in a small app-level provider that runs after it. Because bundle resolution happens during boot, anything that mutates the bundle list must be registered before the package's own boot() completes — listen for a package-provided event or manipulate the config before container boot rather than reaching into internals.
Testing. Add one smoke test that boots the application with your real config and asserts the expected bundles resolve — this catches the config-cache class of bug before deploy. For unit tests, construct the bundle registry directly with an inline array rather than booting the full app; it is much faster and avoids the annotation scanning cost.
Caching in CI. If annotations are scanned, wire the scan into your deploy pipeline (or warm it in a test) so that CI exercises the cached path, not only the uncached one.
php artisan config:cache (or config:clear) in any cached environment. A stale bundle list presents as "my new bundle simply doesn't exist," with no error.0.2.* in composer.json, read the changelog on every bump, and avoid depending on internal classes (registries, resolvers, loaders) — the stable surface is the config file and the annotation, not the machinery behind them.vendor:publish without a --tag may now publish more than you expect (config plus stubs). Use explicit tags so upgrades don't silently overwrite your edited config.php artisan tinker against the registry object before touching the annotation side — it separates "config not loaded" from "annotation not found" in one step, which are the two distinct failure modes this feature introduces.How can I help you explore Laravel packages today?