genelet / php
PHP version of Genelet web development framework
Requires
- guzzlehttp/guzzle: ~6.0
- psr/log: ^1.1
- psr/simple-cache: ^1.0
- twig/twig: ^3.0
This package is auto-updated.
Last update: 2026-05-15 11:14:16 UTC
README
Genelet PHP is a small PHP web framework for JSON-described CRUD-style web applications. A Genelet app keeps its runtime contract in conf/config.json and per-component component.json files, then supplies generated or hand-written Filter and Model classes for each component.
The framework is intentionally legacy-friendly: it uses Composer and PDO, keeps numeric framework error strings stable, and does not require Laravel, Symfony, or a modern full-stack PHP framework.
How It Works
Requests are routed by path:
<Script>/<role>/<tag>/<component>
<Script>/<role>/<tag>/<component>/<id>
config.json defines the project namespace, script path, roles, chartags, authentication providers, templates, and database connection settings. Each component's component.json defines tables, keys, available actions, validation, aliases, groups, fields, foreign-key helpers, and optional next-page model calls.
For a component named question in project namespace Jenny, the application provides:
Jenny\Question\Filter
Jenny\Question\Model
At request time the controller parses the request, creates the filter and model, fills ARGS, executes the requested action, and returns JSON or renders a template depending on the chartag.
Repository Layout
src/- framework runtime.tests/- PHPUnit regression tests.samples/project-php- sample application using this package through a local Composer path repository.views/- minimal framework views used by tests and defaults.conf/test.conf- test configuration.scripts/- Docker-based test harnesses.
Installation
git clone git@github.com:genelet/php.git
cd php
composer install
Test
Run the local PHPUnit suite:
composer test
The default tests expect a MySQL database named test with user genelet_test and a blank password.
Without local PHP, Composer, or MySQL, run the isolated Docker harness:
./scripts/test-docker.sh
The script builds a PHP 8.3 test image, starts a disposable MySQL 8 container, installs Composer dependencies, lints src/ and tests/, and runs PHPUnit.
Run the sample application test harness:
./scripts/test-sample-project-php.sh
Using Genelet
- Create a PHP app with
conf/config.jsondefiningProject,Script,Template,Pubrole,Chartags,Roles, and optional DB/auth settings. - For each component, create a
component.jsonwithactions,current_tableorcurrent_tables, andcurrent_key. - Provide
<Project>\<Component>\Filterand<Project>\<Component>\Modelclasses. - Bootstrap
Genelet\Controllerfrom an entrypoint such aswww/app.php. - Configure Composer autoloading for the app namespace and require
genelet/php.
Generated apps can use no_db for actions that do not need database work and no_method for actions handled entirely by filter/template behavior. JSON chartags return response bodies; HTML-like chartags render templates such as:
<Template>/<role>/<component>/<action>.<tag>
Compatibility Notes
Genelet keeps the legacy generated-app surface stable:
- Public framework class names and public methods remain stable.
- Numeric framework error codes and messages are preserved.
- Cookie behavior, including CLI test cookie mirroring through
$_COOKIE["SET_COOKIE"], is preserved. ARGS,LISTS,OTHER, existing config keys, and nextpage marker names remain part of the runtime contract.