- How do I install this bundle in a Sulu/Symfony project?
- First, require the package via Composer: `composer require alengo/sulu-bunny-cdn-bundle`. Then enable it in `config/bundles.php` and configure BunnyCDN credentials in `config/packages/sulu_bunny_cdn.yaml` under `api_key` and `zone`. Ensure `fos/http-cache-bundle` is installed as a dependency.
- Does this work with Sulu 2.x or only Symfony standalone?
- This bundle is designed for Sulu CMS (built on Symfony) and assumes Sulu’s routing structure. While it technically works with Symfony standalone, full functionality—like `sulu-page:*` tagging—relies on Sulu’s content hierarchy. Test thoroughly if using custom routes.
- What’s the difference between tag-based and URL-based purges?
- Tag-based purges (e.g., `sulu-page:homepage`) invalidate all cached content matching the tag, while URL-based purges target specific paths. This bundle prioritizes tags for efficiency but falls back to URLs if tagging fails. Wildcards like `sulu-page:*` purge entire content types.
- Can I use this with Laravel instead of Symfony/Sulu?
- No, this bundle is specifically built for Symfony/Sulu ecosystems using FOSHttpCache. Laravel would require a different approach, such as integrating BunnyCDN’s API directly or using a Laravel-compatible HTTP cache layer like `spatie/laravel-cache-control`.
- How do I monitor purge success/failure rates?
- The bundle doesn’t include built-in monitoring, but you can track purges via BunnyCDN’s dashboard or API logs. For advanced setups, configure BunnyCDN webhooks to notify your application of purge events, or log responses from the `/fos_http_cache/purge` endpoint.
- Will this break my existing FOSHttpCache configuration?
- No, this bundle extends FOSHttpCache rather than replacing it. However, you must explicitly configure the `sulu_bunny_cdn` purger in your `fos_http_cache` settings. Always test in staging first, especially if you’re using custom cache tags or purge strategies.
- What happens if BunnyCDN’s API rate limits are hit?
- The bundle doesn’t include retry logic by default, so you’ll need to implement it yourself (e.g., using a library like `symfony/http-client` with retries). Monitor API usage via BunnyCDN’s dashboard and adjust your tagging strategy to minimize unnecessary purges.
- Can I invalidate caches for custom Sulu content types (e.g., media blocks)?
- Yes, but you’ll need to define custom cache tags for your content types. For example, use `sulu-media:uuid` for media blocks. Extend the bundle’s tagging logic via event listeners or override the `Purger` service to include your custom tags.
- Is there a performance impact from adding CDN-Tag headers?
- Minimal. CDN-Tag headers are lightweight (e.g., `CDN-Tag: sulu-page:homepage`), but benchmark your responses to ensure they don’t exceed HTTP header limits. If headers become an issue, consider consolidating tags or using a more granular tagging strategy.
- What alternatives exist for edge caching in Sulu/Laravel?
- For Sulu, alternatives include Cloudflare’s purge API (via Symfony HTTP client) or integrating Varnish/Nginx with custom purge endpoints. In Laravel, packages like `spatie/laravel-cache-control` or direct BunnyCDN API calls (via Guzzle) offer flexibility, though they lack FOSHttpCache’s integration depth.