Skip to content

Framework integration · Slim

Slim

Compose Slim's HTTP lifecycle with Fight's explicit container registrars and shared provider adapters.

Slim owns the HTTP lifecycle; Fight registrars and shared adapters fill only the selected application boundaries.

Installation and ownership

Install Fight Common, Slim, a PSR-7 implementation, and only the provider packages selected by the application. The project-slim starter owns the executable bootstrap, container definitions, middleware order, routes, and runtime policy.

composer require johnnickell/fight-common slim/slim

Slim is intentionally close to the framework-free path: portable Fight services remain unchanged and the application composes infrastructure explicitly.

Compose the container

Use the application's PSR-11 container or Fight\Common\Application\Service\Container. Bounded methods on Fight\Common\Adapter\ServiceContainer\Fight\ContainerCapabilityRegistrar register selected synchronous messaging, template-helper, and HTTP-client integrations. Direct constructor wiring is also supported.

There is no aggregate Slim provider. Supply explicit handler maps, subscriber maps, filters, helper services, and collaborators rather than scanning application code or activating optional packages implicitly.

HTTP and routing

Slim uses the shared PSR-15 middleware and PSR-17 response lane. SlimUrlGenerator translates Fight's portable URL-generation contract to Slim named routes. The application owns route registration, base path, middleware order, error middleware, response factories, and request lifecycle.

Do not add Slim-branded wrappers for capabilities already expressed honestly through a PSR or provider adapter.

Shared provider paths

Select provider adapters independently: Doctrine/DBAL for persistence, Symfony Messenger for async messaging, Twig for templates, Symfony Mailer for mail, Symfony Filesystem and Process, Guzzle/PSR-18 for outbound HTTP, Flysystem for storage, Twilio for SMS, Mercure for publication, and PSR-3 plus shared health/audit/metrics for observability.

Async delivery is at least once. The application owns Messenger transports, retries, failures, workers, idempotency, and durable outbox policy. Portable scheduling likewise needs application-owned invocation and locking.

Application-owned operations

Keep database schema, provider configuration, credentials, route and middleware policy, templates, worker supervision, process limits, scheduled invocation, logs, health checks, and deployment in the Slim project. Installing a provider proves availability, not activation or production readiness.

Use the HTTP, Routing, Messaging, and Dependency Injection guides for component behavior. Use the support matrix for capability state.