Search by

keel / framework

AloneCoder

Worker-first PHP micro-framework: PSR stack, attribute routing, compiled container.

Package info

github.com/AloneCoder/keel

pkg:composer/keel/framework

Statistics

Installs: 29

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.7.0 2026-11-04 23:26 UTC

This package is auto-updated.

Last update: 2026-11-29 21:50:56 UTC


README

Keel is a PHP 8.4+ microframework for APIs and web applications. The same controllers run under PHP-FPM and in long-lived FrankenPHP or RoadRunner workers.

Documentation · Changelog · Русский

Quick start

Create an app with composer create-project keel/skeleton my-app, then start its development server.

cd my-app
composer serve

Open http://127.0.0.1:8080/ to see {"hello":"keel"}. The starter controller also shows how to render a Twig page and validate a JSON request.

Documentation

Keel uses PSR-7 messages, PSR-15 middleware and PHP attributes for routing. For production, it can compile the service container and cache the routes.

Keel follows semantic versioning. See API stability for the public API guarantees.

Run the repository example

From the root of this checkout, install the dependencies and start the example server.

composer install
php -S 127.0.0.1:8080 -t examples/hello/public examples/hello/public/index.php

In a second terminal, request a page and list the routes.

curl http://127.0.0.1:8080/hello/world
php examples/hello/bin/console keel:routes

The console ships keel:routes, keel:compile, keel:cache-clear, keel:debug:container, keel:doctor, keel:preload, keel:openapi, keel:serve (built-in server or FrankenPHP worker mode with --watch), keel:install (a component's package, provider, middleware and config in one step), keel:ai:init (AGENTS.md and llms.txt) and the keel:make:* generators for controllers, commands, middleware, listeners, health checks, authenticators and policies; see Application.

Development

composer install
composer test
composer stan
composer cs
composer infection

CI runs the tests on PHP 8.4 and 8.5, PHPStan at level max, php-cs-fixer, and Infection on the container, router, auth, rate limiting, health and metrics (MSI gate 80%).

Packages

keel/framework is the whole thing. Four components are also published on their own as read-only splits of this repository and are replaced by the framework: keel/container, keel/router, keel/http (depends on router and validation) and keel/validation. Issues and pull requests go here; bin/split vX.Y.Z pushes the splits.

Benchmarks

In-process, same route (GET /json/42, JSON body), production mode with warm caches, PHP 8.4.21 with opcache, JIT off, Apple Silicon laptop, 30 000 iterations after warm-up. The number measures framework overhead per request; the SAPI and the network are excluded. Reproduce with cd benchmarks && composer install && php -d opcache.enable_cli=1 run.php.

Framework boot (ms) µs / request requests / s memory after boot
Keel 0.1.0 (compiled container, cached routes) 11.8 4.8 208 000 0.21 MB
Slim 4.15 (closure routes, no container) 5.9 4.8 206 000 0.07 MB
Symfony 8.1 MicroKernel (FrameworkBundle, #[Route]) 29.5 31.0 32 000 0.52 MB

Memory: a production boot loads 30 files (26 classes, 3 cache files, 1 config file), about 0.3 MB of heap without opcache and well under 100 KB with it; Route objects are materialized only for routes that match, and nothing survives a request: 2000 requests in a row add 0 bytes. keel:preload generates an opcache.preload script so php-fpm links every class once: with it a boot allocates 4 KB and loads 3 files, and boot plus first request drops from 12.8 ms to 2.7 ms. Measure with php -d opcache.enable_cli=1 memory.php and memory-classes.php in benchmarks/.

Under a real server: FrankenPHP 1.12 worker mode (8 workers), oha with 64 connections for 10 s on the same laptop, same JSON route: Keel 8 486 requests/s, Slim 8 603 requests/s, median latency 5.2 ms and p99 34 ms for both, every response 200. Reproduce with benchmarks/frankenphp/run.sh.

Keel does more work per request than the Slim app in this table (attribute controller, argument resolution with type casting, Problem Details handler, container-resolved middleware) at the same cost. Symfony's number includes its full HttpKernel event cycle and terminate().

Roadmap

What's next

Feedback from projects using Keel will guide the next release. Queues and schedulers remain outside the framework’s scope.

Released

  • 1.7.0 · Request handling. Limited the cost of parsing large JSON objects and fixed idempotent retries for cookie sessions and multipart requests.

  • 1.6.0 · Access control and routing. Class and method access rules now apply together. Route constraints also check decoded parameter values.

  • 1.5.1 · Security fixes. Isolated cached responses and idempotency keys between clients and tightened request body limits.

  • 1.5.0 · Outgoing requests and mail. Added HTTP retries with a circuit breaker, signed URLs and Symfony Mailer integration.

  • 1.4.0 · HTTP and workers. Added idempotency keys, JWT/JWKS authentication, Server-Sent Events and tasks that run after the response.

  • 1.3.0 · Routing and application services. Added route groups, CSRF protection, access policies, Redis and Memcached support, and keel:doctor diagnostics.

  • 1.2.1 · Tooling. Added generators for health checks and authenticators and expanded mutation testing.

  • 1.2.0 · Integrations. Added PDO and Doctrine DBAL with health checks, Twig and Latte, a dependency-free PSR-16 cache and a cURL-based PSR-18 client.

  • 1.1.0 · Production APIs. Added authentication and rate limiting, health endpoints, Prometheus metrics and OpenAPI 3.1 generation. keel:serve added local development with FrankenPHP workers.

  • 1.0.0 · Stable API. Established the public API covered by semantic versioning.

License

MIT.