341d1bdc2c5140ec4040549ebff15997fce3bc28
Framework-agnostic REST controller toolkit in vanilla PHP. - Router with path parameters, 404 and 405 with an Allow header. - Immutable Request, JsonRequest and Response; nothing is printed. - CrudController over a ResourceGateway port the application implements. - Composable Middleware/Pipeline chain. - Security middlewares: BearerAuth, RequireRole, RateLimit, Cors. - Transport middlewares: Logging, ContentNegotiation. - Nine typed HTTP exceptions with snake_case JSON bodies. - Declares PHP >=8.3 and no dependency on an ORM: ports are local. - MIT license.
camelia/controllers
Framework-agnostic REST controller toolkit: routing, request parsing, validation and JSON responses over any data source. Vanilla PHP, no framework.
- Package:
camelia/controllers— Namespace:Camelia\Controllers - PHP
>=8.3, extensionjson
What it is
The HTTP layer of a REST API, and nothing else:
- Routing with parameters (
/articulos/{id}), plus 404 and 405 responses with anAllowheader. - Immutable request and response objects. Nothing is printed; a
Responseis returned and the adapter emits it. - Generic CRUD over a
ResourceGatewayport that the application implements. - Composable middlewares: authentication, roles, rate limiting, CORS, logging, content negotiation.
What it is not
Not a framework. No dependency-injection container, no ORM, no templating. The package declares its own ports; if an application uses an ORM, it connects it by composition.
Install
composer require camelia/controllers
Documentation
The full developer guide, organised by task, is in
docs/GUIA-PROGRAMADOR.md. The normative contract — public names, JSON
shapes and status codes — is docs/especificaciones-controllers.md.
The documentation index lives in docs/README.md.
Development
composer install
composer check # fmt:check -> lint -> analyze -> phpstan -> test
composer check must be green before anything is merged, and the steps run in that order.
License
MIT. See LICENSE.
Languages
PHP
100%