6: The example app
The phlo-demo-cms repository is a blog/magazine on SQLite, built to be copied.
6.1: What is in it
- Seven models, among them
article,author,categoryandtopic. - Every relation type: parent (author, category), many (topics), child (comments).
- Image uploads on covers and avatars, and a
wysiwygbody. - One portable database: every model stores in
data/cms.db.
6.2: One-command setup
The repo ships with a ready-made dataset (data/cms.db plus the uploaded covers, avatars and attachments), so there is no build or seed step: clone and serve. To regenerate the dataset from scratch (the seeder is fully deterministic and has no dependencies):
php www/app.php seed::run
seed::run drops and recreates every table, so it is always safe to start over. The first HTTP request builds the sources automatically.
6.3: Make it yours
Copy the repository, replace the models in modules/, update %app->models and %app->menu, and adjust the CREATE TABLE statements in seed.phlo to match. Remember the relation-column convention from the Relations chapter: the foreign key is the related model's short name.