rbaezc / hexagenphp-framework
HexaGen PHP Framework - A lightweight, vertical slice framework optimized for FrankenPHP
Package info
github.com/rbaezc/hexagenphp_framework
Type:project
pkg:composer/rbaezc/hexagenphp-framework
Requires
- php: >=8.3
- firebase/php-jwt: ^7.0
- guzzlehttp/guzzle: ^7.0
- predis/predis: ^2.0
- symfony/console: ^7.0
- symfony/dependency-injection: ^7.0
- symfony/http-foundation: ^7.0
- symfony/mailer: ^7.0
- symfony/routing: ^7.0
- twig/twig: ^3.0
Requires (Dev)
- fakerphp/faker: ^1.23
- google/protobuf: ^4.30
- phpunit/phpunit: ^10.0
- psy/psysh: ^0.12
Suggests
- ext-pcntl: Required for graceful schedule:work daemon shutdown
- aws/aws-sdk-php: Required for the S3 storage driver (^3.0)
- google/protobuf: Typed messages for Connect, gRPC-Web and gRPC services (^4.30)
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v2.5.0
- v2.4.0
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.1
- v2.0.0
- v1.0.0
- dev-feat/make-grpc
- dev-feat/rpc-connect-grpc-web
- dev-docs/benchmarks
- dev-ci/no-cancel-on-main
- dev-bench/frankenphp
- dev-fix/telemetry-opt-in
- dev-fix/model-json-hidden
- dev-docs/create-project-skeleton
- dev-fix/make-slice-names
- dev-feat/english-defaults
- dev-feat/base-path
- dev-chore/release-2.2.0
- dev-chore/community-readme
- dev-fix/security-cache-appkey-grpc
- dev-feat/docs-redesign
- dev-feat/portable-like-mysql-ci
- dev-fix/audit-php85-postgres
This package is auto-updated.
Last update: 2026-11-30 03:14:40 UTC
README
HexaGen PHP
Boot once. Ship features as vertical slices.
A PHP 8.3+ framework that keeps each feature in one folder, runs it in a persistent FrankenPHP worker,
and ships an ORM that behaves the same on PostgreSQL, MySQL, MariaDB and SQLite.
Documentation · Get started · Changelog · Contributing
Why HexaGen PHP
Most PHP frameworks organize code by technical layer: all controllers in one place, all models in another. A single feature ends up spread across the whole tree.
HexaGen PHP organizes code by feature. Everything a feature needs lives in its own slice:
src/Slices/
├── Flights/
│ ├── Controller/FlightsController.php
│ ├── Domain/Flight.php
│ ├── Routes.php
│ └── Services.php
└── Bookings/
Delete the folder and the feature is gone. Read the folder and you understand the feature.
- FrankenPHP worker mode. The kernel boots once and serves thousands of requests per process. Routes, reflection and middleware are cached, and per-request state is reset after every response.
- One ORM, four engines. HexaORM is Active Record on PDO. The query builder, Schema Builder, queue and validator generate the right SQL for each engine, and the test suite runs against all of them on every push.
- Batteries included. Auth (session and JWT), validation, mail, queues, cache, storage, events, notifications, scheduler, i18n, Twig views, OpenAPI generation and an HTTP test client.
- Connect and gRPC-Web in pure PHP. Serve
.protoservices to Go, TypeScript, Swift and Kotlin clients, or tocurl, with no extension or proxy. - Secure by default. CSRF, security headers, bcrypt with rehash, hidden model attributes, and HMAC-signed queue and cache payloads.
Performance
Same machine, FrankenPHP worker mode for all three, each with its own ORM against PostgreSQL. Requests per second (full results and method):
| JSON | 1 row | 20 rows | Memory | |
|---|---|---|---|---|
| HexaGen PHP 2.4 | 12,710 | 4,022 | 3,570 | 41 MiB |
| Symfony 7.4 + Doctrine | 9,847 | 3,422 | 3,007 | ~46 MiB |
| Laravel 12 + Octane | 2,229 | 1,529 | 1,287 | ~96 MiB |
Measured on GitHub Actions with the reproducible setup in bench/. Run ./run.sh to check it on your own hardware.
Quick start
composer create-project rbaezc/hexagen-app my-app cd my-app php hexaphp make:slice Flights php hexaphp server:start # http://localhost:8000
create-project installs the application skeleton, creates .env with a random APP_KEY and JWT_SECRET, and puts the framework in vendor/, so composer update brings new releases. The default database is SQLite; no extra services are needed.
Adding it to an existing project instead:
composer require rbaezc/hexagenphp-framework
A slice in practice
// src/Slices/Flights/Controller/FlightsController.php public function index(Request $request): Response { $flights = Flight::query() ->whereLike('origin', $request->query->get('q') . '%') // case-insensitive on every engine ->with(['airline']) // eager loading, no N+1 ->orderBy('price') ->paginate(20); return $this->json($flights->toArray()); }
// src/Slices/Flights/Routes.php Route::get('/flights', [FlightsController::class, 'index'])->name('flights.index'); Route::group(['prefix' => '/api', 'middleware' => ['auth:jwt']], function () { Route::resource('/flights', FlightsController::class); });
Tested on every push
| PHP | 8.3, 8.4, 8.5 |
| Databases | PostgreSQL 16, MySQL 8.4, MariaDB 11.4, SQLite |
| Dependencies | composer audit |
Documentation
The full guide lives at rbaezc.github.io/hexagenphp_framework:
- Installation and configuration
- Architecture and worker mode
- Models and the query builder
- CLI reference
Requirements
- PHP 8.3 or newer and Composer
- SQLite for development; PostgreSQL, MySQL or MariaDB for production
- Redis (optional, for cache and queues)
- FrankenPHP (optional, recommended for production)
Contributing
Bug reports, ideas and pull requests are welcome. Read CONTRIBUTING.md to set up the project and run the test suite. To report a vulnerability, follow SECURITY.md instead of opening a public issue.
License
HexaGen PHP is open-source software released under the MIT license.