A modular PHP framework built on PSR contracts — small packages, sharp boundaries, no magic.
Hydra is a PHP framework assembled from independent packages. Each one does a single job, depends on as little as possible, and codes against an interface rather than its neighbours. The split between framework mechanism and application policy is deliberate: the core defines contracts and orchestration, the packages supply the mechanism, and your app wires them together at the composition root.
The dependency graph flows downward — core knows nothing of the layers above it.
| Package | Role |
|---|---|
hydrakit/core |
The foundation: application object, container & service-provider contracts, typed environment loading. Defines interfaces only — concretes are bound by the app. |
hydrakit/http |
PSR-7 / PSR-15 HTTP layer — request lifecycle, routing, and the middleware pipeline. |
hydrakit/nyholm |
Nyholm PSR-7 / PSR-17 adapter — the default message and factory implementation. |
hydrakit/kernel |
Default composition root and HTTP plumbing — the framework-side wiring app builds on. |
hydrakit/session |
Session handling exposed through PSR-15 middleware. |
hydrakit/database |
A thin PDO-based data layer. |
hydrakit/validation |
Zero-dependency input validation. |
hydrakit/view |
Native PHP templating — no compile step, no new syntax. |
hydrakit/log |
A PSR-3 logger. |
hydrakit/event |
A PSR-14 event dispatcher and listener provider. |
hydrakit/auth |
Authentication, built on the HTTP and session packages. |
hydrakit/authorization |
Ability-based authorization on top of auth. |
hydrakit/csrf |
CSRF protection delivered as middleware. |
hydrakit/console |
The CLI surface, powered by Symfony Console. |
hydrakit/app |
The application skeleton — the composition root every Hydra project starts from. |
- PSR all the way down. Containers, HTTP messages, middleware, logging, and factories speak the PHP-FIG standards, so packages compose with the wider ecosystem and with each other.
- Contracts over concretes. Packages depend on interfaces. The app binds the implementations. Swapping one out is a one-line change at the composition root.
- Mechanism vs. policy. The framework provides the how; your application owns the what. The two never bleed into each other.
- Explicit beats implicit. No facades, no auto-discovery surprises. If a service is available, you can point to the line that bound it.
Every project begins from the hydrakit/app skeleton:
cp .env.example .env # defaults run as-is for local dev
composer install # resolves the framework packages
php bin/console key:generate # writes a fresh APP_KEY
composer start # serve at http://localhost:8000Open http://localhost:8000 and you'll see Welcome to Hydra. A full Docker stack (PHP-FPM, nginx, MariaDB, Redis) is available too — see the app README.
- PHP 8.2+
- Composer
- Optional: Docker + Compose for the full local stack