phil / route-access-check-bundle
phil/route-access-check in Symfony: the console command phil:route-access:check over the router and the firewalls and access_control entries SecurityBundle builds, registered in the dev and test environments only, with detectors and formats of the application's own autoconfigured
Package info
github.com/parler-haut-interagir-librement/route-access-check-bundle
Type:symfony-bundle
pkg:composer/phil/route-access-check-bundle
Requires
- php: >=8.5
- phil/route-access-check: ^0.1@dev
- symfony/config: ^8.2
- symfony/console: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/filesystem: ^8.2
- symfony/http-foundation: ^8.2
- symfony/routing: ^8.2
Requires (Dev)
- phpunit/phpunit: ^13.4
- symfony/event-dispatcher: ^8.2
- symfony/expression-language: ^8.2
- symfony/framework-bundle: ^8.2
- symfony/http-kernel: ^8.2
- symfony/security-bundle: ^8.2
- symfony/security-http: ^8.2
Suggests
- symfony/security-bundle: For the firewalls and access_control entries the check reads
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-11 13:32:29 UTC
README
bin/console phil:route-access:check: every route of the application has an access rule, or the CI step fails.
phil/route-access-check-bundle brings phil/route-access-check into a Symfony application as a console command. It
checks every route of the router against the rules that protect it — #[IsGranted], the firewalls and the
access_control entries of the security configuration, and the explicit public declarations — and exits with 1 when
a route has no rule, or contradicts itself. The report lists each route with its resolved rule, in text for a person,
in JSON for a tool, as GitHub annotations on the controllers, or as JUnit for a CI server.
It is for any Symfony application that wants its access rules reviewed by the build rather than by memory. The
security configuration is read from the services SecurityBundle builds, after every configuration file is merged, so
the check sees exactly what the application runs: when@ blocks, PHP configuration, parameters, route: entries.
It registers its services in the dev and test environments only: no listener, nothing in production.
It is built on the components Symfony already ships: Config and DependencyInjection for the configuration and the compiler pass, Console for the command, Filesystem for the baseline file.
Status
| Part | State |
|---|---|
| The command, its four formats, its baseline and its strict mode | Implemented and tested |
Firewalls and access_control read from SecurityBundle's services |
Implemented and tested, against SecurityBundle in a kernel |
| Controller services whose id is not their class | Implemented and tested |
| Detectors and formats of the application, autoconfigured | Implemented and tested |
| Nothing registered outside the configured environments | Implemented and tested |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, installing, registering the bundle for dev and test only. |
| Configuration | Every key of phil_route_access_check. |
| The command | Its options, exit codes, and a continuous integration step. |
| Extension points | Detectors and formats of the application, the services and parameters. |
| Testing | The bundle's tests, and the check as a test of the application. |
| Reference | Every class, service, tag and parameter of the bundle. |
The rules themselves — how each source is read, when a route is public, the statuses — are documented with the
library, in phil/route-access-check.
Quick start
composer require --dev phil/route-access-check-bundle
// config/bundles.php Phil\RouteAccessCheckBundle\PhilRouteAccessCheckBundle::class => ['dev' => true, 'test' => true],
bin/console phil:route-access:check --env=test bin/console phil:route-access:check --env=test --format=github --only-problems bin/console phil:route-access:check --env=test --generate-baseline
Requirements
PHP 8.5 or later, phil/route-access-check, and Symfony 8.2: Config, Console, DependencyInjection, Filesystem,
HttpFoundation and Routing. SecurityBundle is read when it is installed.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.