trunk/core

An async, API-centric PHP framework built on ReactPHP

Maintainers

Package info

github.com/pspepp3r/trunk

pkg:composer/trunk/core

Transparency log

Statistics

Installs: 7

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.1 2026-07-25 00:06 UTC

This package is auto-updated.

Last update: 2026-07-25 00:19:29 UTC


README

Trunk

Trunk

An async, API-centric PHP framework built on ReactPHP.

Trunk runs your API on a single, non-blocking event loop instead of PHP-FPM's one-process-per-request model. The router, middleware pipeline, ORM, sessions, and CLI all share that loop, so a slow database query doesn't tie up an entire worker - it ties up nothing, because nothing is blocked while it's in flight.

Features

  • DI container with constructor autowiring by reflection, plus singleton/factory bindings.
  • Router with path params, route model binding, and per-route middleware.
  • Validation via FormRequest classes that short-circuit to a 422 before your handler runs.
  • Database layer for MySQL and PostgreSQL behind one API, with a migrations system (Schema/Blueprint DSL) and a Data Mapper ORM.
  • JWT authentication and a CORS/JSON-body-parsing/logging/session middleware stack, on by default.
  • Events, object-typed, with config-driven listener registration and a non-blocking dispatchAsync().
  • GraphQL endpoint (via webonyx/graphql-php's async promise adapter) sharing the same ORM queries as REST.
  • gRPC client support via a child-process bridge - PHP can't run a gRPC server, so this lets you call one without blocking the loop.
  • Console (php trunk ...) for the dev server, code generation, and migrations.

Installation

Trunk is consumed through a skeleton application, not installed standalone. See the skeleton's README to get a project running, or Getting Started for the full walkthrough.

Documentation

The full guide lives in docs/ - run npm install && npm run docs:dev inside that directory for the local site, or just read the Markdown directly:

Testing

composer install
composer test

License

MIT