Search by

getphex / framework

illegalvuppi

A PHP web framework designed for native ElephC compilation.

Package info

github.com/getphex/framework

pkg:composer/getphex/framework

Statistics

Installs: 3

Dependents: 1

Suggesters: 0

Stars: 1

Open Issues: 0

v0.1.0 2026-11-04 14:41 UTC

This package is auto-updated.

Last update: 2026-11-04 17:21:41 UTC


README

Phex logo

Phex

Run on PHP. Compile with ElephC.

PHP 8.3 or newer ElephC 0.27.6 Status: in development

PHP-compatible sources · Native compilation · Immutable HTTP · Typed middleware

A PHP web framework designed first for native compilation with ElephC. Run the same shared sources directly on PHP, with immutable HTTP messages, typed handlers and middleware, and an explicit middleware pipeline.

Overview

Phex is a PHP web framework designed for native compilation with ElephC. Shared application sources run directly on PHP, with explicit dependency injection, immutable HTTP messages, typed middleware and precompilable routing.

Develop on PHP without generating artifacts. Build generated PHP for PHP-FPM, or compile a native HTTP executable. Native application lifecycle can retain application services per worker while each request receives an isolated scope.

Phex is in development. The current checkout includes a portable application skeleton, typed JSON/query input, named URLs, structured logging and an optional PDO module with a persistent SQLite CRUD example.

Documentation

Read the Phex handbook for focused guides, practical examples and a learning path from your first endpoint to PHP/native deployment.

Start with Learn how to
Installation Create an application from this checkout
Quickstart Add a typed endpoint, service and named route
Lifecycle Separate application state from request state
HTTP guides Route requests, compose middleware and validate input
SQLite CRUD Persist data through PHP and native HTTP
Builds Choose development, generated PHP or native execution
Native servers Configure workers, application lifetime and startup

Requirements

  • PHP 8.3 or newer within PHP 8.x and Composer 2 for applications.
  • A complete ElephC SDK for native compilation; CI targets release 0.27.6 and precompiled release 0.27.7 with application-lifecycle support. The CI downloads official release SDKs and does not build ElephC from source.
  • PDO and the selected driver when using the optional database adapter.
  • Python 3.10+ and pdo_sqlite for framework development checks.

Linux native builds also need the platform's assembler/linker, libc development files and bzip2 development library. See Installation.

Create an application

From a framework checkout, before a versioned package release:

composer install --no-dev
php bin/phex new ../my-app --local
cd ../my-app
composer install
composer serve

Open http://127.0.0.1:8080/ for {"hello":"world"}. Development PHP needs no build artifacts. --local adds an explicit mirrored Composer path dependency on this checkout. Continue with the Quickstart.

Build PHP or native output

Inside the created application:

composer build
php -S 127.0.0.1:8080 -t public public/compiled.php

For native execution, after stopping the PHP server:

composer build:native
./var/build/start --listen 127.0.0.1:8080 --workers 1

Builds explains regeneration. PHP deployment and Native servers describe runtime configuration and artifacts.

Examples

The framework checkout includes hello-world, routing, request lifetimes, compiled containers and persistent SQLite CRUD. The canonical application template lives in stubs/application and is automatically published to getphex/phex. See Package distribution.

Static analysis

From the framework repository root:

composer install
composer tools:install
composer analyse

PHPStan runs at maximum level without a baseline or broad suppressions. PHP files follow the required purpose-header template. The contribution guide describes shared-source conventions.

Test both runtimes

composer check

The framework checks generated artifacts, installed HTTP applications and matching PHP/ElephC behavior cases. Application-capable SDKs can also run composer test:persistent. See Testing for requirements and application test examples, or Benchmarking for measurement tools.

License

Phex is licensed under the MIT License. Copyright (c) 2026 Vincenzo Petrucci (Illegal Studio).