2025-12-14 23:10:01 +00:00
# Phred Framework Milestones
2025-12-23 23:39:06 +00:00
[← Back to README ](./README.md ) | [SPECS.md ](./SPECS.md )
2025-12-14 23:10:01 +00:00
Phred supports REST and JSON:API via env setting; batteries-included defaults, swappable components.
2025-12-23 23:39:06 +00:00
[↑ 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 )
- [Notes on sequencing and parallelization ](#notes-on-sequencing-and-parallelization )
2025-12-14 23:10:01 +00:00
## ~~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.~~
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-14 23:10:01 +00:00
## ~~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`).~~
2025-12-15 02:09:06 +00:00
* ~~Addendum: Route groups (prefix only) via `Router::group()` ~~
2025-12-14 23:10:01 +00:00
* ~~Acceptance:~~
* ~~Sample route returning a JSON 200 via controller.~~
* ~~Controllers are invokable (`__invoke(Request)`), one route per controller.~~
2025-12-15 02:09:06 +00:00
* ~~Route groups (prefix only) work and are tested.~~
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-15 02:09:06 +00:00
## ~~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.~~
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-15 15:15:49 +00:00
## ~~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` .~~
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-15 15:15:49 +00:00
## ~~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.~~
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
Implement M5 service providers, M6 MVC bases, and URL extension negotiation; update docs and tests
• M5: Add ServiceProviderInterface and ProviderRepository; integrate providers into Kernel (register before container build, boot after); add RouteRegistry with clear(); add default core providers (Routing, Template, ORM, Flags, Testing) and AppServiceProvider; add contracts and default drivers (Template/Eyrie, Orm/Pairity, Flags/Flagpole, Testing/Codeception)
• Routing: allow providers to contribute routes; add ProviderRouteTest
• Config: add config/providers.php; extend config/app.php with driver keys; document env keys
• M6: Introduce MVC bases: Controller, APIController (JSON helpers), ViewController (html + renderView helpers), View (transformData + renderer); add ViewWithDefaultTemplate and default-template flow; adjust method signatures to data-first and delegate template override to View
• HTTP: Add UrlExtensionNegotiationMiddleware (opt-in via URL_EXTENSION_NEGOTIATION, whitelist via URL_EXTENSION_WHITELIST with default json|php|none); wire before ContentNegotiationMiddleware
• Tests: add UrlExtensionNegotiationTest and MvcViewTest; ensure RouteRegistry::clear prevents duplicate routes in tests
• Docs: Update README with M5 provider usage, M6 MVC examples and template selection conventions, and URL extension negotiation; mark M5 complete in MILESTONES; add M12 task to provide XML support and enable xml in whitelist by default
2025-12-15 22:08:57 +00:00
## ~~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.~~
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
Refactor M7 module scaffolding, route inclusion, and tests; implement providers discovery; fix URL extension negotiation; clean docs
• Add Service Providers loading from config/providers.php and merge with runtime config; ensure AppServiceProvider boots and contributes routes
• Create RouteGroups and guard module route includes in routes/web.php; update Kernel to auto-mount module routes and apply provider routes
• Implement create:module as a console Command (extends Phred\Console\Command):
◦ Args: name, prefix; Flags: --update-composer, --no-dump
◦ Stable root resolution (dirname(DIR, 2)); robust args/flags handling under ArrayInput
◦ Scaffolds module dirs (Controllers, Views, Templates, Routes, Providers, etc.), ensures Controllers exists, adds .gitkeep
◦ Writes Provider, View, Controller, Template stubs (fix variable interpolation via placeholders)
◦ Appends guarded include snippet to routes/web.php
◦ Optional composer PSR-4 mapping update (+ backup) and optional autoload dump
◦ Prevents providers.php corruption via name validation and existence checks
• Add URL extension negotiation middleware tweaks:
◦ Only set Accept for .json (and future .xml), never for none/php
◦ Never override existing Accept header
• Add MVC base classes (Controller, APIController, ViewController, View, ViewWithDefaultTemplate); update ViewController signature and View render contract
• Add tests:
◦ CreateModuleCommandTest with setup/teardown to snapshot/restore routes/web.php and composer.json; asserts scaffold and PSR-4 mapping
◦ ProviderRouteTest for provider-contributed route
◦ UrlExtensionNegotiationTest sets API_FORMAT=rest and asserts content-type behavior
◦ MvcViewTest validates transformData+render
• Fix config/providers.php syntax and add comment placeholder for modules
• Update README: M5/M6/M7 docs, MVC examples, template selection conventions, modules section, URL extension negotiation, and module creation workflow
• Update MILESTONES.md: mark M6/M7 complete; add M8 task for register:orm; note M12 XML extension support
2025-12-16 22:14:22 +00:00
## ~~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(<template>, <data>)` .~~
* ~~Acceptance:~~
* ~~Example page rendered through View → Template; API coexists with full‑ site rendering.~~
* ~~Rendering works via RendererInterface and can be swapped (e.g., Eyrie → Twig demo) with only configuration/provider changes.~~
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
Refactor M7 module scaffolding, route inclusion, and tests; implement providers discovery; fix URL extension negotiation; clean docs
• Add Service Providers loading from config/providers.php and merge with runtime config; ensure AppServiceProvider boots and contributes routes
• Create RouteGroups and guard module route includes in routes/web.php; update Kernel to auto-mount module routes and apply provider routes
• Implement create:module as a console Command (extends Phred\Console\Command):
◦ Args: name, prefix; Flags: --update-composer, --no-dump
◦ Stable root resolution (dirname(DIR, 2)); robust args/flags handling under ArrayInput
◦ Scaffolds module dirs (Controllers, Views, Templates, Routes, Providers, etc.), ensures Controllers exists, adds .gitkeep
◦ Writes Provider, View, Controller, Template stubs (fix variable interpolation via placeholders)
◦ Appends guarded include snippet to routes/web.php
◦ Optional composer PSR-4 mapping update (+ backup) and optional autoload dump
◦ Prevents providers.php corruption via name validation and existence checks
• Add URL extension negotiation middleware tweaks:
◦ Only set Accept for .json (and future .xml), never for none/php
◦ Never override existing Accept header
• Add MVC base classes (Controller, APIController, ViewController, View, ViewWithDefaultTemplate); update ViewController signature and View render contract
• Add tests:
◦ CreateModuleCommandTest with setup/teardown to snapshot/restore routes/web.php and composer.json; asserts scaffold and PSR-4 mapping
◦ ProviderRouteTest for provider-contributed route
◦ UrlExtensionNegotiationTest sets API_FORMAT=rest and asserts content-type behavior
◦ MvcViewTest validates transformData+render
• Fix config/providers.php syntax and add comment placeholder for modules
• Update README: M5/M6/M7 docs, MVC examples, template selection conventions, modules section, URL extension negotiation, and module creation workflow
• Update MILESTONES.md: mark M6/M7 complete; add M8 task for register:orm; note M12 XML extension support
2025-12-16 22:14:22 +00:00
## ~~M7 — Modules (Django‑ style app structure)~~
* ~~Tasks:~~
* ~~Define module filesystem layout (Nested Controllers/Views/Services/Models/Templates/Routes/Tests).~~
* ~~Module loader: auto‑ register providers, routes, templates.~~
* ~~Namespacing and autoload guidance.~~
* ~~Core CLI: add `create:module <name>` command to scaffold a module with nested resources.~~
* ~~ORM‑ agnostic module layout (to support Pairity DAO/DTO and Eloquent Active Record):~~
* ~~`Modules/< X > /Models/` — domain models (pure PHP, ORM‑ neutral)~~
* ~~`Modules/< X > /Repositories/` — repository interfaces (DI targets for services)~~
* ~~`Modules/< X > /Persistence/Pairity/` — DAOs, DTOs, mappers, repository implementations~~
* ~~`Modules/< X > /Persistence/Eloquent/` — Eloquent models, scopes, repository implementations~~
* ~~`Modules/< X > /Database/Migrations/*` — canonical migrations for the module (no duplication per driver)~~
* ~~Acceptance:~~
* ~~Creating a module with the CLI makes it discoverable; routes/templates work without manual wiring.~~
* ~~Switching `ORM_DRIVER` between `pairity` and `eloquent` requires no changes to services/controllers; providers bind repository interfaces to driver implementations.~~
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-21 23:01:10 +00:00
## ~~M8 — Database access, migrations, and seeds~~
* ~~Tasks:~~
* ~~Integrate `getphred/pairity` for ORM/migrations/seeds.~~
* ~~Define config (`DB_*`), migration paths (app and modules), and seeder conventions.~~
* ~~CLI commands: `migrate` , `migration:rollback` , `seed` , `seed:rollback` .~~
* ~~All persistence usage in examples goes through Orm contracts; can be swapped (Pairity → Doctrine adapter demo optional).~~
* ~~Add `register:orm <driver>` command:~~
* ~~Verify or guide installation of the ORM driver package.~~
* ~~Update `.env` (`ORM_DRIVER=< driver > `) safely.~~
* ~~Create `modules/*/Persistence/<Driver>/` directories for existing modules.~~
* ~~Acceptance:~~
* ~~Running migrations modifies a test database; seeds populate sample data; CRUD demo works.~~
* ~~All persistence usage in examples goes through Orm contracts; can be swapped (Pairity → Doctrine adapter demo optional).~~
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-22 21:52:41 +00:00
## ~~M9 — CLI (phred) and scaffolding~~
* ~~Tasks:~~
* ~~Implement Symfony Console app in `bin/phred` .~~ ✓
* ~~Generators: `create:<module>:controller` , `create:<module>:model` , `create:<module>:migration` , `create:<module>:seed` , `create:<module>:test` , `create:<module>:view` .~~ ✓
* ~~Utility commands: `test[:<module>]` , `run` , `db:backup` , `db:restore` .~~ ✓
* ~~Acceptance:~~
* ~~Commands generate files with correct namespaces/paths and pass basic smoke tests.~~
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-22 21:52:41 +00:00
## ~~M10 — Security middleware and auth primitives~~
* ~~Tasks:~~
* ~~Add CORS, Secure Headers middlewares; optional CSRF for template routes.~~ ✓
* ~~JWT support (lcobucci/jwt) with simple token issue/verify service.~~ ✓
* ~~Configuration for CORS origins, headers, methods.~~ ✓
* ~~Bind FeatureFlagClientInterface with a default adapter (Flagpole); add small sample usage and env config.~~ ✓
* ~~Acceptance:~~
* ~~CORS preflight and secured endpoints behave as configured; JWT‑ protected route example works.~~ ✓
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-23 00:00:45 +00:00
## ~~M11 — Logging, HTTP client, and filesystem~~
* ~~Tasks:~~
* ~~Monolog setup with handlers and processors (request ID, memory, timing).~~ ✓
* ~~Guzzle PSR‑ 18 client exposure; DI binding for HTTP client interface.~~ ✓
* ~~Flysystem integration with local adapter; abstraction for storage disks.~~ ✓
* ~~Standardize all core service providers with robust driver validation (similar to OrmServiceProvider).~~ ✓
2025-12-23 00:12:38 +00:00
* ~~Opportunity Radar: Multiple storage disks, log channel management, and HTTP client middleware.~~ ✓
2025-12-23 23:39:06 +00:00
* ~~Opportunity Radar 2: Storage Disk "Cloud" Adapters (S3), Advanced HTTP Middleware (Circuit Breaker), and Log Alerting (Slack/Sentry).~~ ✓
* ~~Opportunity Radar 3: Githook Integration, Breadcrumb Automation, and TOC for MILESTONES.md.~~ ✓
2025-12-23 00:00:45 +00:00
* ~~Acceptance:~~
* ~~Logs include correlation IDs; sample outbound HTTP call via client; file upload/storage demo works.~~ ✓
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
## ~~M12 — Serialization/validation utilities and pagination~~
* ~~Tasks:~~
* ~~REST default: Symfony Serializer normalizers/encoders; document extension points.~~ ✓
* ~~Add simple validation layer using `Phred\Http\Middleware\Middleware` base.~~ ✓
* ~~Pagination helpers (links/meta), REST and JSON:API compatible outputs.~~ ✓
* ~~URL extension negotiation: add XML support~~ ✓
* ~~Provide `XmlResponseFactory` (or encoder) and integrate with negotiation.~~ ✓
* ~~Enable `xml` in `URL_EXTENSION_WHITELIST` by default.~~ ✓
* ~~Opportunity Radar: Storage URL generation, Circuit Breaker persistence (PSR-16), and HTTP client profiling.~~ ✓
* ~~Acceptance:~~
* ~~Example endpoint validates input, returns 422 with details; paginated listing includes links/meta.~~ ✓
[↑ Back to Top ](#table-of-contents )
2025-12-14 23:10:01 +00:00
## M13 — OpenAPI and documentation
* Tasks:
* Integrate `zircote/swagger-php` annotations.
* CLI/task to generate OpenAPI JSON; optional serve route and Redoc UI pointer.
* Document auth, pagination, error formats.
* Acceptance:
* Generated OpenAPI document validates; matches sample endpoints.
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-14 23:10:01 +00:00
## M14 — Testing, quality, and DX
* Tasks:
* Establish testing structure with Codeception (unit, integration, API suites).
* Add fixtures/factories via Faker for examples.
* PHPStan level selection and baseline; code style via php-cs-fixer ruleset.
2025-12-22 22:04:15 +00:00
* Pre‑ commit hooks (e.g., GrumPHP) or custom git hooks for staged files.
2025-12-14 23:10:01 +00:00
* Define TestRunnerInterface and a Codeception adapter; otherwise, state tests are run via Composer script only.
* Acceptance:
* `composer test` runs green across suites; static analysis passes.
* CLI tests run via TestRunnerInterface;
* CLI tests run green per module and across suites.
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-14 23:10:01 +00:00
## M15 — Caching and performance (optional default)
* Tasks:
* Provide `PSR-16` cache interface binding; suggest `symfony/cache` when enabled.
* Simple response caching middleware and ETag/Last‑ Modified helpers.
* Rate limiting middleware (token bucket) suggestion/integration point.
* Acceptance:
* Sample endpoint demonstrates cached responses and conditional requests.
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-14 23:10:01 +00:00
## M16 — Production hardening and deployment
* Tasks:
* Config for envs (dev/test/stage/prod), error verbosity, trusted proxies/hosts.
* Docker example, PHP‑ FPM + Nginx config templates.
* Healthcheck endpoint, readiness/liveness probes.
* Acceptance:
* Containerized demo serves both API and template pages; healthchecks pass.
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-14 23:10:01 +00:00
## M17 — JSON:API enhancements (optional package)
* Tasks:
* If enabled, integrate `neomerx/json-api` fully: includes, sparse fieldsets, relationships, sorting, filtering, pagination params.
* Adapters/Schema providers per resource type.
* Acceptance:
* JSON:API conformance tests for selected endpoints pass; docs updated.
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-14 23:10:01 +00:00
## M18 — Examples and starter template
* Tasks:
* Create `examples/blog` module showcasing controllers, views, templates, ORM, auth, pagination, and both API formats.
2025-12-22 21:52:41 +00:00
* Ensure examples use the external stubs and module-specific CLI command conventions.
2025-12-14 23:10:01 +00:00
* Provide `composer create-project` skeleton template instructions.
* Acceptance:
* New users can scaffold a working app in minutes following README.
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-14 23:10:01 +00:00
## M19 — Documentation site
* Tasks:
2025-12-23 23:39:06 +00:00
* Build the official documentation site (getphred.com) using the Phred framework.
* Internal Documentation API: Design a "Documentation Module" that parses Markdown files from the repo to serve them dynamically.
* ~~Automated TOC Generation: Script to regenerate SPECS.md Table of Contents.~~ ✓
2025-12-14 23:10:01 +00:00
* Versioned docs and upgrade notes.
* Acceptance:
* Docs published; links in README; examples maintained.
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
## M20 — Dynamic Command Help
* Tasks:
* Implement a `docs` command in `phred` (e.g., `php phred docs <command>` ) that opens the relevant documentation page in the user's browser.
* Build the `docs` command logic after the documentation site (getphred.com) is functional.
* Acceptance:
* `php phred docs create:module` opens the correct URL in the default browser.
[↑ Back to Top ](#table-of-contents )
## M21 — Governance and roadmap tracking
2025-12-14 23:10:01 +00:00
* Tasks:
* Define contribution guide, issue templates, RFC process for changes.
* Public roadmap (this milestone list) tracked as GitHub Projects/Issues.
* Acceptance:
* Contributors can propose features via RFC; roadmap is visible and updated.
2025-12-23 23:39:06 +00:00
[↑ Back to Top ](#table-of-contents )
2025-12-14 23:10:01 +00:00
## Notes on sequencing and parallelization
* M0– M4 are critical path for the HTTP core and should be completed sequentially.
* M5– M8 can progress in parallel with M9 (CLI) once the kernel is stable.
* Optional tracks (M15, M17) can be deferred without blocking core usability.