Skip to content

Symfony ​

Knossos reads a Symfony project's controllers, routes, commands, message handlers, event listeners and services from the PHP source and its attributes. It loads no autoloader, imports no application class, compiles no container and boots no kernel.

A project counts as Symfony when any composer.json in the scan requires symfony/framework-bundle, symfony/http-kernel, symfony/console or symfony/messenger, or when you list symfony under frameworks in your project configuration. Generic PHP facts (declarations, inheritance, calls, construction, types and constructor injection) are in the graph whether or not a convention is recognized.

What you get ​

AreaRecognized sourceGraph facts
ControllersAbstractController, #[AsController], #[Route]controller and route-handler roles
Routesclass-level and method-level #[Route] paths, names and methods (a list or one string); the class-level route alone on an invokable controller routes to __invokeroute nodes and routes_to edges
Commands#[AsCommand(name: ...)], or protected static $defaultName; an argv ['php', 'bin/console', 'name'] calls the command of that namecommand nodes and handles edges
Messenger#[AsMessageHandler] and a typed handler parametermessage-handler roles and handles_message edges
Events#[AsEventListener], EventSubscriberInterface, static subscriber arrayslistener and subscriber roles, listens_to edges
Services#[AsAlias], #[Autoconfigure], typed constructors, #[Autowire(service: ...)]service roles, binds and injects edges
ValidationDoctrine annotations such as @AdminEmail, and a Constraint's <Name>Validatorreferences edges
Migrationsthe directories migrations_paths names in the Doctrine Migrations YAMLentry points
Handlersa services.yaml resource: block with tags:: every class in its directoryentry points
SerializerJMS Serializer @VirtualProperty and #[VirtualProperty] methodsruntime_invoked

Attribute values have to be strings, string arrays or class constants. A dynamic route path, command name or event target produces a diagnostic instead of a guessed fact: SYMFONY_DYNAMIC_ROUTE_PATH, SYMFONY_DYNAMIC_COMMAND_NAME or SYMFONY_DYNAMIC_EVENT. Evidence always points at the attribute, declaration, parameter or subscriber entry that produced the fact.

Route names ​

A literal route name passed to generateUrl() or redirectToRoute() in a controller, or to generate() on a receiver typed as UrlGeneratorInterface or RouterInterface, becomes an endpoint node that carries the name, with a calls_endpoint edge from the enclosing method. The core joins it to the route with that name, and only to a Symfony route. A name built at run time gives nothing, and Twig templates are not read. See from request to handler.

Limits ​

  • YAML and XML service and route imports are not interpreted. The one exception is the directory of a tagged resource: block.
  • Container extensions, compiler passes, runtime service decoration, generated containers and expression-language values are not executed.
  • Subscriber arrays record the event keys that are visible in the source. A subscription computed at runtime is omitted.
  • An attribute alias with an expression Knossos cannot read stays a generic PHP attribute.