# Phred Framework Milestones Phred supports REST and JSON:API via env setting; batteries-included defaults, swappable components. ## ~~M0 — Project bootstrap (repo readiness)~~ * ~~Tasks:~~ * ~~Finalize `composer.json` (namespaces, scripts, suggests) and `LICENSE`.~~ * ~~Add `.editorconfig`, `.gitattributes`, `.gitignore`, example `.env.example`.~~ * ~~Set up CI (lint, static analysis, unit tests) and basic build badge.~~ * ~~Acceptance:~~ * ~~Fresh clone installs (without running suggested packages) and passes linters/analysis/tests.~~ ## ~~M1 — Core HTTP kernel and routing~~ * ~~Tasks:~~ * ~~Implement the HTTP kernel: `PSR-15` pipeline via `Relay`.~~ * ~~Wire `nyholm/psr7(-server)` factories and server request creation.~~ * ~~Integrate `nikic/fast-route` with a RouteCollector and dispatcher.~~ * ~~Define route → controller resolution (invokable controllers).~~ * ~~Add minimal app bootstrap (front controller) and DI container wiring (`PHP-DI`).~~ * ~~Addendum: Route groups (prefix only) via `Router::group()`~~ * ~~Acceptance:~~ * ~~Sample route returning a JSON 200 via controller.~~ * ~~Controllers are invokable (`__invoke(Request)`), one route per controller.~~ * ~~Route groups (prefix only) work and are tested.~~ ## ~~M2 — Configuration and environment~~ * ~~Tasks:~~ * ~~Load `.env` via `vlucas/phpdotenv` and expose `Phred\Support\Config`.~~ * ~~Define configuration precedence and document keys (e.g., `API_FORMAT`, `APP_ENV`, `APP_DEBUG`).~~ * ~~Acceptance:~~ * ~~App reads config from `.env`; unit test demonstrates override behavior.~~ ## ~~M3 — API formats and content negotiation~~ * ~~Tasks:~~ * ~~Finalize `ContentNegotiationMiddleware` using `.env` and `Accept` header.~~ * ~~Bind `ApiResponseFactoryInterface` to `RestResponseFactory` or `JsonApiResponseFactory` based on format.~~ * ~~Provide developer‑facing helpers for common responses (`ok`, `created`, `error`).~~ * ~~Acceptance:~~ * ~~Demo endpoints respond correctly as REST or JSON:API depending on `API_FORMAT` and `Accept`.~~ ## ~~M4 — Error handling and problem details~~ * ~~Tasks:~~ * ~~Finalize `ProblemDetailsMiddleware` with RFC7807 (REST) and JSON:API error documents.~~ * ~~Integrate `filp/whoops` for dev mode (`APP_DEBUG=true`).~~ * ~~Map common exceptions to HTTP status codes; include correlation/request IDs in responses/logs.~~ * ~~Acceptance:~~ * ~~Throwing an exception yields a standards‑compliant error response; debug mode shows Whoops page.~~ ## ~~M5 — Dependency Injection and Service Providers~~ * ~~Tasks:~~ * ~~Define Service Provider interface and lifecycle (register, boot).~~ * ~~Module discovery loads providers in order (core → app → module).~~ * ~~Add examples for registering controllers, services, config, and routes via providers.~~ * ~~Define contracts: `Template\Contracts\RendererInterface`, `Orm\Contracts\*`, `Flags\Contracts\FeatureFlagClientInterface`, `Testing\Contracts\TestRunnerInterface`.~~ * ~~Define config/env keys for driver selection (e.g., `TEMPLATE_DRIVER`, `ORM_DRIVER`, `FLAGS_DRIVER`, `TEST_RUNNER`).~~ * ~~Provide “default adapter” Service Providers for the shipped packages and document swap procedure.~~ * ~~Acceptance:~~ * ~~Providers can contribute bindings and routes; order is deterministic and tested.~~ * ~~Drivers can be switched via `.env`/config without changing controllers/services; example provider route covered by tests.~~ ## ~~M6 — MVC: Controllers, Views, Templates~~ * ~~Tasks:~~ * ~~Controller base class and conventions (request/response helpers).~~ * ~~View layer (data preparation) with `getphred/eyrie` template engine integration.~~ * ~~Template rendering helper: `$this->render(