Files
camelia-controller/README.md
T
dgarcia 807992ecab
Tests / PHP 8.4 (push) Failing after 1m26s
refactor!: require PHP 8.4
Drop support for PHP 8.3 and lower. The package now declares >=8.4, and CI runs
only on 8.4.

- composer.json: require php >=8.4.
- mago.toml: php-version = "8.4", matching the minimum supported version.
- phpstan.neon: phpVersion 80400.
- Upgrade phpstan/phpstan to ^2.3: 1.x cannot parse `new Foo()->bar()`, which the
  8.4 formatter now emits.
- Narrow ArrayGateway::count() to int, matching what the fixture actually returns.
- CI: single PHP 8.4 job using the php:8.4-cli container instead of setup-php,
  which failed with a TLS handshake timeout on the runner.

BREAKING CHANGE: PHP 8.4 is now required.
2026-11-15 10:58:17 -03:00

56 lines
2.2 KiB
Markdown

# camelia/controllers
[![Latest Stable Version](https://img.shields.io/packagist/v/camelia/controllers.svg)](https://packagist.org/packages/camelia/controllers)
[![Total Downloads](https://img.shields.io/packagist/dt/camelia/controllers.svg)](https://packagist.org/packages/camelia/controllers)
[![License](https://img.shields.io/packagist/l/camelia/controllers.svg)](https://packagist.org/packages/camelia/controllers)
[![Tests](https://git.dr2gsistemas.duckdns.org/dr2gsistemas/camelia-controller/actions/workflows/tests.yml/badge.svg)](https://git.dr2gsistemas.duckdns.org/dr2gsistemas/camelia-controller/actions)
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.4`, extension `json`
## What it is
The HTTP layer of a REST API, and nothing else:
- **Routing** with parameters (`/articulos/{id}`), plus 404 and 405 responses with an `Allow` header.
- **Immutable request and response** objects. Nothing is printed; a `Response` is returned and the
adapter emits it.
- **Generic CRUD** over a `ResourceGateway` port 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
```bash
composer require camelia/controllers
```
## Documentation
The full developer guide, organised by task, is in
[`docs/GUIA-PROGRAMADOR.md`](docs/GUIA-PROGRAMADOR.md). The normative contract — public names, JSON
shapes and status codes — is [`docs/especificaciones-controllers.md`](docs/especificaciones-controllers.md).
The documentation index lives in [`docs/README.md`](docs/README.md).
## Development
```bash
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](LICENSE).