Search by

rbaezc / hexagenphp-framework

rbaezc

HexaGen PHP Framework - A lightweight, vertical slice framework optimized for FrankenPHP

v2.5.0 2026-11-29 20:31 UTC

README

HexaGen PHP

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.

Tests Latest version PHP version MIT license

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 .proto services to Go, TypeScript, Swift and Kotlin clients, or to curl, 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:

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.