Skip to content

The command

phil/route-access-check-bundle
bin/console phil:route-access:check [--format=text|json|github|junit] [--baseline=FILE] [--generate-baseline[=FILE]] [--only-problems] [--strict]
OptionMeaning
--format, -fThe format of the report on the standard output: text (default), json, github, junit, or a format of the application.
--baseline, -bThe baseline file whose failures are tolerated; by default the configured one.
--generate-baselineWrites the current failures to this file, or to the configured baseline, or to route-access-baseline.json, then exits with 0.
--only-problemsLeaves out the routes that pass.
--strictFails on warnings too: access_control entries that reach no route, stale baseline entries, inexact sample paths.

The report goes to the standard output, raw, so that --format=json > report.json writes a valid document. The messages about the command itself — an unknown format, an unreadable baseline, the baseline written — go to the error output.

Exit codes

CodeWhen
0Every route passes, or its failure is tolerated by the baseline; with --strict, no warning either.
1A route is uncovered or conflicts, and the baseline does not tolerate it; with --strict, or a warning remains.
2The format is unknown, or the baseline cannot be read: missing, larger than 5 MB, or not a baseline document.

In continuous integration

# .github/workflows/ci.yaml
- name: Route access
  run: bin/console phil:route-access:check --env=test --format=github --only-problems

The GitHub format annotates each failing route on its controller's file and line. For a CI server that reads JUnit:

bin/console phil:route-access:check --env=test --format=junit > var/route-access.xml

Adopting the check

On an application with many routes, generate the baseline once, commit it, and let the check fail only on new failures:

bin/console phil:route-access:check --env=test --generate-baseline

Fix the tolerated routes one by one; --strict then reports each baseline entry already fixed, so that it is removed and the baseline only shrinks.