jengo/api
jengo/api is an automated, configuration-driven REST API and OpenAPI/Swagger engine for CodeIgniter 4 and the Jengo Framework. It provides declarative resource routing, schema-driven querying, atomic bulk transactional writes, validation form mapping, and real-time interactive Swagger documentation.
What's Inside
| Section | Description |
|---|---|
| Key Capabilities | A summary of everything the package ships with. |
| Installation | Install via Composer and publish the config. |
| Defining Resource Configurations | Access policies, versioning, allowed relations, and validation rules. |
| Registering Resources | Wire resources into app/Config/JengoApi.php. |
| Routes & Swagger Documentation | Publish versioned endpoints, OpenAPI JSON, and interactive Swagger UI. |
| Query Parameters | Standardized pagination, sorting, search, and derivation params. |
| Relational Mutations & Bulk Writes | Atomic batch and nested relational writes. |
| Lifecycle Hooks | Intercept records before and after queries and saves. |
| CLI Commands | Scaffold resource configs and publish configuration. |
Key Capabilities
- Automated REST Resource Routing: Expose full CRUD endpoints automatically with clean HTTP verb mapping (
GET,POST,PUT,PATCH,DELETE). - Interactive OpenAPI & Swagger UI: Auto-generates complete OpenAPI 3.0 specs and embeds an interactive Swagger UI with zero manual annotation upkeep.
- Declarative Resource Configurations: Define access policies, versioning, allowed relations, and validation rules in clean
ResourceConfigclasses. - Relational Tree Derivations: Query and resolve deeply nested relationship graphs on the fly using
?derive=relation_name. - Atomic Bulk & Nested Writes: Batch array insertions and nested relationship writes executed sequentially inside database transaction savepoints.
- Database Key Obfuscation: Native integration with Sqids to hash and decode auto-increment primary and foreign keys automatically.
- Granular Validation Mapping: Bind HTTP verbs directly to specific FormHandler or validation classes.
- Lifecycle Mutation Hooks: Intercept records before and after queries and saves via
beforeQuery,afterQuery,beforeSave, andafterSave. - Version Mutation Chaining: Chain and serve multiple concurrent API versions from a single routing declaration.
