Skip to content

Boot once.Ship features as vertical slices.

HexaGen PHP keeps each feature's controller, model, routes and services in one folder, runs them in a persistent FrankenPHP worker, and ships an ORM that behaves the same on PostgreSQL, MySQL and SQLite.

src/Slices/Flights/Controller/FlightsController.php
  • Slices/
  • Flights/
  • Controller/
  • FlightsController.php
  • Domain/
  • Flight.php
  • routes.php
  • services.php
  • Bookings/
public function index(Request $request): Response
{
    $flights = Flight::query()
        ->whereLike('origin', $request->query->get('q') . '%')
        ->with(['airline'])
        ->orderBy('price')
        ->paginate(20);

    return $this->json($flights->toArray());
}

// Same rows on PostgreSQL, MySQL and SQLite.
Tested on every push against
  • PostgreSQL 16
  • MySQL 8.4
  • MariaDB 11.4
  • SQLite
  • PHP 8.3 · 8.4 · 8.5

From zero to a running slice

  1. 01Create the projectcomposer create-project rbaezc/hexagen-app my-app
  2. 02Generate a slicephp hexaphp make:slice Flights
  3. 03Start the workerphp hexaphp server:start

Released under the MIT License.