Core package for the Safi Microframework (PHP 8.5+). Built around pure constructor injection, explicit composition root wiring, an HTTP context pipeline, attribute routing, and driver contracts.
- No Service Locators: Controllers and services never pull from a global container. All dependencies are explicitly declared in constructors via PHP 8.5 property promotion.
- Composition Root: The
Assembleris used exclusively during application startup (init.inc.phpor CLI entry points) to wire components together deterministically.
- Combines
Request,Response, andLoggerInterfaceinto a strictContextobject flowing through theMiddlewarePipeline. - Eliminates messy parameter lists and keeps infrastructure concerns out of domain logic.
- Routes are defined via PHP attributes directly on controller methods.
- Default Lockdown: All endpoints require authentication (
401 Unauthorized) unless explicitly configured aspublic: true.
src/
├── Attributes/ # #[Route] definition
├── Cli/ # Command interface & kernel
│ └── Commands/ # Core maintenance tasks
├── Contracts/ # Interfaces (Router, View, Database, Search)
├── Event/ # Synchronous event dispatcher
├── Exception/ # Core exceptions
├── Http/ # Request, Response, Context, Pipeline
├── Services/ # Cache, JobQueue, Security
└── Util/ # Token-based class finder
Distributed under the MIT License. Author: Jean Bruenn