assouan / demo
Example demo using the A PHP framework libraries.
dev-main
2026-06-23 15:01 UTC
Requires
- php: >=8.5
- assouan/ff-cli: ^0.1
- assouan/router: ^0.1
- assouan/snowflake: ^0.1
This package is auto-updated.
Last update: 2026-06-23 16:53:37 UTC
README
Example application for the A PHP framework libraries.
It shows the intended simple path:
app.phpboots the HTTP application.- Controllers live in
app/and use#[A\Http\Route]. - Templates sit next to controllers as
.phtmlfiles and use#[A\Http\Template]. app/Layout.phtmlis a shared file layout selected by templates with$layout.- API handlers live in
api/and return arrays/objects as JSON. - Database schemas live in
config/schema/. - FF generates ORM models in
src/Model*and SQL indata/generated/sql/. - FF also generates API/form contracts in
data/generated/contracts/so the sample documents what handlers and forms should expose. src/ModelBase/*is regenerated;src/Model/*is generated once then kept for app-specific methods.- Put small domain helpers such as
Article::published(),Article::for_manager(),Article::summary(),Article::state_name(), andAccount::public_data()insrc/Model/*. - Protected manager pages can use the same generated models for writes, as shown by
/manager/articles. - New article IDs use
assouan/snowflakethroughArticle::new_id(). - Authentication uses generated
AccountandAccountSessionmodels plus PHP sessions; the other identity schemas are extension points.
Run locally
From this repository:
composer install
From the workspace root, with the Docker webstack running:
docker compose up -d
Then from this repository:
composer setup
Manual equivalent:
composer ff composer db composer check
Then open:
http://demo.localhost/
Default account:
admin / password
Useful checks:
composer check
Useful environment overrides:
demo_db_host=127.0.0.1 demo_db_port=3306 demo_db_user=root demo_db_password= demo_db_dsn=mysql:host=127.0.0.1;port=3306;charset=utf8mb4 demo_base_url=http://127.0.0.1 demo_host=demo.localhost
Example routes:
GET / HTML home
GET /articles Generated ORM page
GET /articles/{slug} Generated ORM detail page
GET /contracts Generated FF API/form contracts
GET /contracts/{group}/{name} Generated FF contract detail
GET /dashboard Protected page
GET /manager/articles Protected ORM write page
POST /manager/articles Create an article with the ORM
POST /manager/articles/{slug}/delete Delete an article with the ORM
GET /select/Ada Route parameter + template
GET /auth/sign-in Login form
GET /api/health JSON endpoint with PHP version
GET /api/articles JSON ORM endpoint
GET /api/articles/{slug} JSON ORM detail endpoint
POST /api/echo JSON body input
GET /api/me JSON auth endpoint