Screening Entry Level

What is the services.yaml file and what does the default configuration do? Explain autowire, autoconfigure, and the resource directive.

Quick Tip

Show what the defaults give you: "With autowire and autoconfigure, I create a class with type-hinted constructor parameters and Symfony wires it automatically. I only add explicit config when I need to bind a scalar value or choose between multiple implementations of an interface."

What good answers include

services.yaml is the main service configuration file. The default configuration sets autowire: true (automatically inject dependencies by type-hint), autoconfigure: true (automatically apply tags based on interfaces — e.g., classes implementing EventSubscriberInterface are tagged as event subscribers), and uses a resource directive to register all classes under src/ as services, excluding entities and the kernel. This means most classes are automatically available as services with zero configuration. Strong candidates explain: that autowire eliminates the need to manually specify constructor arguments, that autoconfigure replaces manual tag definitions, and when you need explicit service definitions (binding scalar parameters, aliasing interfaces with multiple implementations).

What interviewers are looking for

Fundamental Symfony configuration question. Candidates who do not understand autowire will manually wire every service. Those who understand the three defaults (autowire, autoconfigure, resource) can explain why most Symfony apps need very little service configuration.

← All Symfony questions