From ceec5727ed93a7e192267866e5f9824a2057c513 Mon Sep 17 00:00:00 2001 From: rtcoder Date: Tue, 16 Jun 2026 21:23:44 +0200 Subject: [PATCH 1/2] Document completed refactoring steps --- REFACTORING.md | 69 +++++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/REFACTORING.md b/REFACTORING.md index 219ce2d..612a8a1 100644 --- a/REFACTORING.md +++ b/REFACTORING.md @@ -2,24 +2,33 @@ ShiftPHP is moving toward an API-only modular monolith. View templates, compiled view storage, page assets and MVC rendering are out of scope for this line. -## 0.5 Scope - -Implemented in this branch: - -- module-owned routing, -- route parameters with `{name}` placeholders, -- controller actions returning response objects, -- `Response`, `JsonResponse` and `ResponseEmitter`, -- JSON response helpers on the base controller, -- request helpers for query, post, input, raw body, JSON and route params, -- JSON errors for `400`, `404` and `500`, -- `405 Method Not Allowed` with an `Allow` header, -- lightweight API core tests through `composer test`, -- `route:list` CLI command, -- PHP 8 attributes for controller routing, -- PHP 8 attributes for response metadata and parameter binding, -- modular monolith support through `application/modules/*/Module.php`, -- removal of view storage and example page assets from runtime. +## Completed + +- [x] API-only runtime direction. +- [x] Route parameters with `{name}` placeholders. +- [x] Controller actions returning response objects. +- [x] `Engine\Response\Response`, `JsonResponse` and `ResponseEmitter`. +- [x] JSON response helpers on the base controller. +- [x] Request helpers for query, post, input, raw body, JSON and route params. +- [x] JSON errors for `400`, `404` and `500`. +- [x] `405 Method Not Allowed` with an `Allow` header. +- [x] Lightweight API core tests through `composer test`. +- [x] `route:list` CLI command. +- [x] PHP 8 attributes for controller routing. +- [x] PHP 8 attributes for response metadata and parameter binding. +- [x] Modular monolith support through `application/modules/*/Module.php`. +- [x] Module-owned controllers, routes, services and commands. +- [x] Removal of view storage and example page assets from runtime. +- [x] Removal of legacy `application/controllers` and `application/routes.php`. +- [x] Domain-oriented engine namespaces: + - `Engine\Response` + - `Engine\Routing\Router` + - `Engine\Routing\Attributes` + - `Engine\Service` + - `Engine\Modules` +- [x] GitHub API workflow with PHP 8.3 checks. +- [x] PR version label validation. +- [x] Release workflow using PR summary as release notes. ## Modular Monolith Direction @@ -127,11 +136,19 @@ Internal errors return a generic `500` message unless `display_errors` is enable - `Engine/Error/StorageError.php` - example CSS and JS page assets - `View\\` composer namespace - -## Next After 0.5 - -- Middleware pipeline. -- Controller autowiring through the container. -- Validation helpers and typed request DTOs. -- CORS and auth middleware. -- Structured logging for exceptions. +- `application/controllers` +- `application/routes.php` + +## Next + +- [ ] Middleware pipeline. +- [ ] Controller autowiring through the container. +- [ ] Validation helpers and typed request DTOs. +- [ ] CORS middleware. +- [ ] Authentication and authorization middleware contracts. +- [ ] Structured logging for exceptions. +- [ ] Module configuration loading. +- [ ] Module lifecycle hooks, for example `boot()` after service registration. +- [ ] Module discovery cache for production. +- [ ] CLI command namespaces and command metadata. +- [ ] Basic package-quality checks, for example static analysis and coding style. From 32452edcc172f186b7e9914b710cccffd3c37786 Mon Sep 17 00:00:00 2001 From: rtcoder Date: Tue, 16 Jun 2026 21:31:20 +0200 Subject: [PATCH 2/2] Rename framework namespace to Shift --- Engine/App.php | 28 ++++++------- Engine/Console/Cli.php | 2 +- Engine/Console/CommandInterface.php | 2 +- Engine/Console/Commands/Help.php | 2 +- Engine/Console/Commands/RouteList.php | 8 ++-- Engine/Console/Commands/Serve.php | 2 +- Engine/Console/Console.php | 2 +- Engine/Console/Shift.php | 4 +- Engine/Controller.php | 10 ++--- Engine/Error/ErrorHandler.php | 4 +- Engine/Error/HttpError.php | 2 +- Engine/Error/ShiftError.php | 4 +- Engine/Error/ShiftError/ErrorHighlighter.php | 2 +- Engine/Error/ShiftError/StackTrace.php | 2 +- Engine/Modules/AbstractModule.php | 6 +-- Engine/Modules/ModuleInterface.php | 6 +-- Engine/Modules/ModuleLoader.php | 6 +-- Engine/Request.php | 6 +-- Engine/Response/JsonResponse.php | 2 +- Engine/Response/Response.php | 2 +- Engine/Response/ResponseEmitter.php | 2 +- Engine/Routing/AttributeRouteLoader.php | 8 ++-- Engine/Routing/Attributes/Body.php | 2 +- Engine/Routing/Attributes/Delete.php | 2 +- Engine/Routing/Attributes/Get.php | 2 +- Engine/Routing/Attributes/Header.php | 2 +- Engine/Routing/Attributes/Patch.php | 2 +- Engine/Routing/Attributes/PathParam.php | 2 +- Engine/Routing/Attributes/Post.php | 2 +- Engine/Routing/Attributes/Put.php | 2 +- Engine/Routing/Attributes/QueryParam.php | 2 +- Engine/Routing/Attributes/Route.php | 2 +- Engine/Routing/Attributes/RoutePrefix.php | 2 +- Engine/Routing/Attributes/Status.php | 2 +- Engine/Routing/Router/Route.php | 4 +- Engine/Routing/Router/RouteMatch.php | 2 +- Engine/Routing/Router/Router.php | 6 +-- Engine/Service/ServiceContainer.php | 4 +- Engine/Service/ServiceInterface.php | 4 +- Engine/Tools/ClassFinder.php | 2 +- Engine/Utils/Debug.php | 2 +- Engine/Utils/helpers.php | 4 +- README.md | 28 ++++++------- REFACTORING.md | 20 +++++----- .../modules/Health/Commands/Health.php | 4 +- .../Health/Controllers/HealthController.php | 8 ++-- application/modules/Health/Module.php | 8 ++-- bootstrap.php | 6 +-- composer.json | 4 +- index.php | 6 +-- shift.php | 4 +- tests/ApiCoreTest.php | 40 +++++++++---------- 52 files changed, 145 insertions(+), 147 deletions(-) diff --git a/Engine/App.php b/Engine/App.php index 9647609..145dd70 100755 --- a/Engine/App.php +++ b/Engine/App.php @@ -1,18 +1,18 @@ statusCode = $response->getStatusCode(); $this->headers = $response->getHeaders();