- Can Oro Twig Inspector work with Laravel without Symfony?
- Yes, but you’ll need to manually integrate it using the `laravel/twig-bridge` package. The package itself is built for Symfony, so Laravel users must register the Twig extension in `AppServiceProvider` and handle routing conflicts (e.g., by prefixing the `/_inspector` endpoint).
- What Laravel versions does Oro Twig Inspector support?
- The package targets PHP 8.0+ and requires Twig 2.x (via `laravel/twig-bridge`). It’s compatible with Laravel 9+ but may need adjustments for older versions due to dependency mismatches. Always pin Twig versions in `composer.json` to avoid conflicts.
- How do I secure the /_inspector endpoint in production?
- The endpoint should never be exposed publicly. Use Laravel middleware (e.g., `auth:api` or IP whitelisting) to restrict access. For Symfony, configure firewall rules in `security.yaml`. Disable the endpoint entirely in production via environment checks.
- Will Oro Twig Inspector slow down my CI/CD pipeline?
- The inspector adds minimal runtime overhead (~1–5ms per request), but enabling it in CI/CD could impact test speed. Disable it in non-development environments by checking `APP_ENV` or using a feature flag. Test performance in staging before full deployment.
- Does this package work with mixed Blade and Twig templates?
- No, it only inspects Twig templates. If your app uses Blade alongside Twig, the inspector will ignore Blade files, potentially leading to incomplete debugging. Stick to Twig-heavy projects or use native Blade debugging tools like `php artisan view:clear` or Xdebug.
- How do I customize the inspector’s endpoint URL?
- The default `/_inspector` endpoint can conflict with Laravel routes. Override it by creating a custom route in `routes/web.php` or using middleware to rewrite requests. For Symfony, adjust the bundle’s routing configuration in `config/routes.yaml`.
- Are there alternatives to Oro Twig Inspector for Laravel?
- For Laravel, consider `laravel-debugbar` (basic Twig/Blade debugging) or Xdebug for deep template inspection. If using Symfony, `WebProfilerBundle` offers similar Twig profiling. However, Oro Twig Inspector provides a dedicated, lightweight solution for Twig-heavy apps.
- How do I test if the inspector is working correctly?
- Visit the `/_inspector` endpoint (or your custom URL) and verify it returns JSON data for rendered Twig templates. Test with complex layouts (e.g., nested blocks or `extends`) to ensure all dependencies are detected. Use browser dev tools to inspect the response structure.
- What happens if I have conflicting Twig extensions (e.g., WebProfilerBundle)?
- Conflicts may arise if multiple extensions modify Twig’s runtime behavior. For Symfony, disable the WebProfilerBundle’s Twig profiler to avoid duplication. In Laravel, ensure no other package overrides Twig’s environment setup in `AppServiceProvider`.
- Is Oro Twig Inspector actively maintained? What if the package stagnates?
- The last release was in February 2025, but the MIT license allows forks or community maintenance. Monitor the GitHub repo for updates or consider contributing fixes. For critical projects, evaluate alternatives like `twig/extra-bundle` or build a custom solution.