andres-montanez/fragment-cache-bundle
HttpKernel changes).@FragmentCache() annotations, which integrates cleanly with Symfony’s dependency injection and metadata system. Modern alternatives (e.g., Symfony’s built-in ResponseCache or HttpCache) may offer more flexibility.HttpKernel, requiring minimal changes to existing controllers or Twig templates.{{ render(controller(...)) }} calls, but does not support modern Twig’s {% embed %} or {% include %} natively (may require workarounds).RequestContext deprecation, HttpKernel changes).CacheClearer events).cache:clear, event listeners)?{% include %} or {% embed %} (may not work out-of-the-box)?ResponseCache?HttpCache or Varnish ESI instead?Blade directives) a better fit for a PHP stack?{{ render(controller(...)) }} calls. Not recommended for modern Twig templates unless adapted.>=2.3.0, <3.0.0).RequestContext, HttpKernel).composer require andres-montanez/fragment-cache-bundle
AppKernel.php:
new FragmentCacheBundle\FragmentCacheBundle(),
@FragmentCache() to controllers or methods for fragments to cache.use FragmentCacheBundle\Annotation\FragmentCache;
class FooterController {
/**
* @FragmentCache()
*/
public function footerAction() { ... }
}
config.yml:
fragment_cache:
driver: apcu # or redis, memcached
{% include %} or {% embed %} without modifications.cache:clear post-deploy or event listeners).HttpCache or Varnish ESI if scaling issues arise.HttpKernel—migrating away is non-trivial.cache:clear post-update).{% include %}).{{ render(controller(...)) }} or fork the bundle.@FragmentCache() annotation usage.HttpKernel to test fragment caching.fragment_cache.log).How can I help you explore Laravel packages today?