# Phred Framework Milestones [← Back to README](./README.md) | [SPECS.md](./SPECS.md) Phred supports REST and JSON:API via env setting; batteries-included defaults, swappable components. [↑ Back to Top](#table-of-contents) ## Table of Contents - [M0 — Project bootstrap (repo readiness)](#m0-project-bootstrap-repo-readiness) - [M1 — Core HTTP kernel and routing](#m1-core-http-kernel-and-routing) - [M2 — Configuration and environment](#m2-configuration-and-environment) - [M3 — API formats and content negotiation](#m3-api-formats-and-content-negotiation) - [M4 — Error handling and problem details](#m4-error-handling-and-problem-details) - [M5 — Dependency Injection and Service Providers](#m5-dependency-injection-and-service-providers) - [M6 — MVC: Controllers, Views, Templates](#m6-mvc-controllers-views-templates) - [M7 — Modules (Django‑style app structure)](#m7-modules-django-style-app-structure) - [M8 — Database access, migrations, and seeds](#m8-database-access-migrations-and-seeds) - [M9 — CLI (phred) and scaffolding](#m9-cli-phred-and-scaffolding) - [M10 — Security middleware and auth primitives](#m10-security-middleware-and-auth-primitives) - [M11 — Logging, HTTP client, and filesystem](#m11-logging-http-client-and-filesystem) - [M12 — Serialization/validation utilities and pagination](#m12-serialization-validation-utilities-and-pagination) - [M13 — OpenAPI and documentation](#m13-openapi-and-documentation) - [M14 — Testing, quality, and DX](#m14-testing-quality-and-dx) - [M15 — Caching and performance (optional default)](#m15-caching-and-performance-optional-default) - [M16 — Production hardening and deployment](#m16-production-hardening-and-deployment) - [M17 — JSON:API enhancements (optional package)](#m17-json-api-enhancements-optional-package) - [M18 — Examples and starter template](#m18-examples-and-starter-template) - [M19 — Documentation site](#m19-documentation-site) - [M20 — Dynamic Command Help](#m20-dynamic-command-help) - [M21 — Governance and roadmap tracking](#m21-governance-and-roadmap-tracking) ## M0 — Project bootstrap (repo readiness) * Tasks: - [x] Finalize `composer.json` (namespaces, scripts, suggests) and `LICENSE`. - [x] Add `.editorconfig`, `.gitattributes`, `.gitignore`, example `.env.example`. - [x] Set up CI (lint, static analysis, unit tests) and basic build badge. * Acceptance: - [x] Fresh clone installs (without running suggested packages) and passes linters/analysis/tests. [↑ Back to Top](#table-of-contents) ## M1 — Core HTTP kernel and routing * Tasks: - [x] Implement the HTTP kernel: `PSR-15` pipeline via `Relay`. - [x] Wire `nyholm/psr7(-server)` factories and server request creation. - [x] Integrate `nikic/fast-route` with a RouteCollector and dispatcher. - [x] Define route → controller resolution (invokable controllers). - [x] Add minimal app bootstrap (front controller) and DI container wiring (`PHP-DI`). - [x] Addendum: Route groups (prefix only) via `Router::group()` * Acceptance: - [x] Sample route returning a JSON 200 via controller. - [x] Controllers are invokable (`__invoke(Request)`), one route per controller. - [x] Route groups (prefix only) work and are tested. [↑ Back to Top](#table-of-contents) ## M2 — Configuration and environment * Tasks: - [x] Load `.env` via `vlucas/phpdotenv` and expose `Phred\Support\Config`. - [x] Define configuration precedence and document keys (e.g., `API_FORMAT`, `APP_ENV`, `APP_DEBUG`). * Acceptance: - [x] App reads config from `.env`; unit test demonstrates override behavior. [↑ Back to Top](#table-of-contents) ## M3 — API formats and content negotiation * Tasks: - [x] Finalize `ContentNegotiationMiddleware` using `.env` and `Accept` header. - [x] Bind `ApiResponseFactoryInterface` to `RestResponseFactory` or `JsonApiResponseFactory` based on format. - [x] Provide developer‑facing helpers for common responses (`ok`, `created`, `error`). * Acceptance: - [x] Demo endpoints respond correctly as REST or JSON:API depending on `API_FORMAT` and `Accept`. [↑ Back to Top](#table-of-contents) ## M4 — Error handling and problem details * Tasks: - [x] Finalize `ProblemDetailsMiddleware` with RFC7807 (REST) and JSON:API error documents. - [x] Integrate `filp/whoops` for dev mode (`APP_DEBUG=true`). - [x] Map common exceptions to HTTP status codes; include correlation/request IDs in responses/logs. * Acceptance: - [x] Throwing an exception yields a standards‑compliant error response; debug mode shows Whoops page. [↑ Back to Top](#table-of-contents) ## M5 — Dependency Injection and Service Providers * Tasks: - [x] Define Service Provider interface and lifecycle (register, boot). - [x] Module discovery loads providers in order (core → app → module). - [x] Add examples for registering controllers, services, config, and routes via providers. - [x] Define contracts: `Template\Contracts\RendererInterface`, `Orm\Contracts\*`, `Flags\Contracts\FeatureFlagClientInterface`, `Testing\Contracts\TestRunnerInterface`. - [x] Define config/env keys for driver selection (e.g., `TEMPLATE_DRIVER`, `ORM_DRIVER`, `FLAGS_DRIVER`, `TEST_RUNNER`). - [x] Provide “default adapter” Service Providers for the shipped packages and document swap procedure. * Acceptance: - [x] Providers can contribute bindings and routes; order is deterministic and tested. - [x] Drivers can be switched via `.env`/config without changing controllers/services; example provider route covered by tests. [↑ Back to Top](#table-of-contents) ## M6 — MVC: Controllers, Views, Templates * Tasks: - [x] Controller base class and conventions (request/response helpers). - [x] View layer (data preparation) with `getphred/eyrie` template engine integration. - [x] Template rendering helper: `$this->render(