getphex / phex
The application skeleton for the Phex framework.
Requires
- php: ^8.3
- getphex/framework: ^0.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
The official getphex/phex repository is an
automatically published mirror of
stubs/application in getphex/framework.
Contribute template changes in the framework monorepo. Projects created from this
template are independent applications.
This project runs directly on PHP and can be compiled with ElephC. Read the Phex handbook for complete guides.
Develop on PHP
From this application directory:
composer install composer serve
Open http://127.0.0.1:8080/ for {"hello":"world"}. Edit application types in
app/, bindings in config/services.php and routes in routes/web.php.
Development PHP needs no generated artifacts.
curl -i http://127.0.0.1:8080/greet \ -H 'Content-Type: application/json' --data '{"name":"Ada"}' curl 'http://127.0.0.1:8080/search?page=2&limit=10&active=true&sort=desc'
The Quickstart walks through a new endpoint and service.
Build generated PHP
composer build php -S 127.0.0.1:8080 -t public public/compiled.php
Rebuild after structural changes to routes, bindings or source declarations. The build guide contains the complete regeneration matrix.
Compile native HTTP
composer build:native ./var/build/start --listen 127.0.0.1:8080 --workers 1
Stop an existing server before reusing its port. config/server.php chooses
Request lifecycle by default. Application lifecycle retains one container per
worker and needs an SDK with --web-lifecycle support. Select a compiler through
PHEX_ELEPHC.
The native server guide explains lifecycle, startup overrides, artifacts and tested runtime limitations.
Configure and test
Settings are read at application startup through typed environment factories:
PHEX_GREETING=phex PHEX_PAGE_SIZE=10 PHEX_UPPERCASE_GREETING=true composer serve
Supply credentials through runtime configuration. Each request receives a fresh
trusted X-Request-Id, used in structured server logs. Keep request dependencies
at request lifetime when using retained native workers.
See Configuration, Logging and Testing for full examples.