cohete / framework
Async PHP micro-framework on ReactPHP: HTTP server, JSON routing, DI container and message bus
v0.2.0
2026-11-25 17:26 UTC
Requires
- php: ^8.2
- evenement/evenement: ^3.0
- fig/http-message-util: ^1
- for/http-middleware-psr15-adapter: ^2.0
- middlewares/client-ip: ^2.0
- monolog/monolog: ^3.5
- nikic/fast-route: ^1.3
- php-di/php-di: ^7.0
- react/event-loop: ^1.5
- react/http: ^1.9
- react/promise: ^3.0
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Async PHP framework built on ReactPHP and RxPHP. ~600 LOC.
Installation
composer require cohete/framework
What's included
- Kernel - HTTP request dispatcher with FastRoute
- Router - JSON-based route definitions
- ReactHttpServer - Non-blocking HTTP server on ReactPHP
- ContainerFactory - PHP-DI container with sensible defaults
- MessageBus - Async event bus (EventBus, CommandBus, QueryBus)
- JsonResponse - Response factory for JSON APIs
- Middleware - Request/Response dumpers for debugging
Quick start
$container = ContainerFactory::create([ TodoRepository::class => fn() => new InMemoryTodoRepository(), ]); $kernel = new Kernel($container, __DIR__ . '/routes.json'); ReactHttpServer::init( host: '0.0.0.0', port: '8080', kernel: $kernel, loop: Loop::get(), );
See cohete/skeleton for a full working example.
Requirements and PHP matrix
PHP 8.2 to 8.5 ("php": "^8.2"). Every version is tested with nix flake check, which runs the
tests and PHPStan in one check per PHP version: 8.2, 8.3, 8.4 and 8.5. Dependencies are pinned by composer.lock
and fetched once in a fixed-output derivation shared by all the checks.
nix develop # shell with PHP 8.5 and Composer (nix develop .#php82 for another version) composer install nix run .#test-php85 # phpunit with one version (test-php82, test-php83, test-php84, test-php85) nix flake check # the whole matrix
License
MIT