Search by

cohete / framework

pascualmg

Async PHP micro-framework on ReactPHP: HTTP server, JSON routing, DI container and message bus

v0.2.0 2026-11-25 17:26 UTC

This package is auto-updated.

Last update: 2026-12-04 21:23:16 UTC


README

CI

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