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:3130/ 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:3130/greet \ -H 'Content-Type: application/json' --data '{"name":"Ada"}' curl 'http://127.0.0.1:3130/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:3130 -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
The project pins ElephC 0.27.7 in .elephc-version. With
elvm installed and its elephc shim on
PATH, run these commands from this application directory:
elvm install composer build:native ./var/build/start --listen 127.0.0.1:3131 --workers 1
elvm install downloads the pinned release SDK without changing your global
selection. Commit .elephc-version when changing the project's compiler version.
PHP development does not require ElephC or elvm.
Native HTTP uses http://127.0.0.1:3131/ by default and can run alongside PHP on
port 3130. 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. Set PHEX_ELEPHC to an
explicit compiler path to override the normal PATH selection.
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.