Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Twig Inspector

Twig Inspector Laravel Package

oro/twig-inspector

Oro Twig Inspector helps developers quickly identify which Twig templates and blocks render parts of an HTML page, making it easier to debug and customize layouts during development. Includes documentation and installation guides; MIT licensed.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Twig Inspector
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.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky