Skip to content

Framework integration · Symfony

Symfony

Register selected compiler passes and provider adapters in the application container without introducing a Fight bundle.

The application owns service loading and aliases; Fight supplies bounded compiler passes and provider adapters.

Installation and ownership

Install Fight Common plus only the Symfony components required by the application. Symfony packages are optional Fight Common dependencies; the project-symfony starter owns the booted application, service configuration, environment values, and lifecycle.

composer require johnnickell/fight-common symfony/dependency-injection

Portable Domain and Application code stays unchanged. Symfony configuration belongs at the Adapter edge.

Activate selected capabilities

Register only the compiler passes needed by the application from Fight\Common\Adapter\ServiceContainer\Symfony: command handlers, command filters, query handlers, query filters, event subscribers, template helpers, and event-mapping providers. Each pass owns one bounded discovery or registration concern.

Fight Common deliberately provides no aggregate Symfony bundle. The application owns service resource loading, autoconfiguration, compiler-pass registration, public aliases, transport DSNs, and environment configuration.

Native and provider composition

Use canonical Symfony adapters where Symfony owns the integration seam: Messenger buses and serialization, HTTP middleware and JSend responses, routing, Mailer, Filesystem, Process, and Doctrine persistence. Compose Twig, Mercure, cache, PSR HTTP, and other shared provider lanes directly when no additional framework translation is needed.

Do not add a Fight wrapper around PSR-3, PSR-7, or another accepted contract solely for symmetry. See the individual component guide for construction, errors, and consequential behavior.

Messaging and workers

MessengerCommandBus, MessengerEventDispatcher, and SymfonyMessageSerializer transport complete Fight messages. Neutral CommandMessageHandler and EventMessageHandler invoke the configured synchronous bus or dispatcher after receipt.

Delivery is at least once. Configure transports, routing, retries, failure transports, workers, signals, and supervision in the Symfony application. Post-commit submission is not an atomic outbox, and an event retry repeats the complete synchronous fan-out.

Application-owned operations

The application owns migrations, transaction boundaries, secrets, route definitions, middleware order, mail transport, process limits, scheduled invocation, logs, metrics, health checks, and deployment. A component being installed does not activate its Fight adapter.

Use the Messaging, Routing, Mail, and Process guides for behavior. Use the support matrix to distinguish shipped adapters from direct wiring.