From b5123ec907df051e76a830a1ff0d7b2d953582d9 Mon Sep 17 00:00:00 2001 From: Dominik Zogg Date: Sat, 29 Aug 2026 19:12:43 +0200 Subject: [PATCH] update migration guides Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01YC213VD8r6UH1LD5iXmYff --- README.md | 2 - doc/Migration/2.x-3.x.md | 3 ++ doc/Migration/3.x-4.x.md | 83 --------------------------------- doc/Migration/Slim-Chubbyphp.md | 5 +- 4 files changed, 7 insertions(+), 86 deletions(-) delete mode 100644 doc/Migration/3.x-4.x.md diff --git a/README.md b/README.md index a407cec..34d1983 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,6 @@ $app->emit($app->handle((new ServerRequestFactory())->createFromGlobals())); ## Migration - * [3.x to 4.x][212] * [2.x to 3.x][211] * [1.x to 2.x][210] * [Slim to Chubbyphp][219] @@ -230,5 +229,4 @@ Dominik Zogg 2021 [210]: doc/Migration/1.x-2.x.md [211]: doc/Migration/2.x-3.x.md -[212]: doc/Migration/3.x-4.x.md [219]: doc/Migration/Slim-Chubbyphp.md diff --git a/doc/Migration/2.x-3.x.md b/doc/Migration/2.x-3.x.md index caeeb84..805f152 100644 --- a/doc/Migration/2.x-3.x.md +++ b/doc/Migration/2.x-3.x.md @@ -1,5 +1,8 @@ # 2.x to 3.x +Note: `chubbyphp/chubbyphp-framework-router-aura` and `chubbyphp/chubbyphp-framework-router-sunrise` are abandoned, +only `chubbyphp/chubbyphp-framework-router-fastroute` and `chubbyphp/chubbyphp-framework-router-symfony` are still maintained. + ## Aura.Router 1. Upgrade: `composer require chubbyphp/chubbyphp-framework "^3.4" chubbyphp/chubbyphp-framework-router-aura` diff --git a/doc/Migration/3.x-4.x.md b/doc/Migration/3.x-4.x.md deleted file mode 100644 index 9640723..0000000 --- a/doc/Migration/3.x-4.x.md +++ /dev/null @@ -1,83 +0,0 @@ -# 3.x to 4.x - -## Routing - -Removed the following methods on group: `group`, `route`, `middlewares`, `middleware`, `pathOptions`, use additional parameters. -Removed the following methods on route: `middlewares`, `middleware`, `pathOptions`, use additional parameters. - -### from - -```php -Group::create('/{id}') - ->pathOptions(['tokens' => ['id' => '\d+']]) - ->middleware($middleware1) - ->route(Route::get('/{slug}', 'element_read', $handler) - ->pathOptions(['tokens' => ['slug' => '[a-z]+']]) - ->middleware($middleware2) - ) - ->group(Group::create('/{slug}') - ->pathOptions(['tokens' => ['slug' => '[a-z]+']]) - ->middlewares([$middleware2]) - ->route(Route::get('/{key}', 'another_route', $handler) - ->pathOptions(['tokens' => ['key' => '[a-z]+']]) - ->middleware($middleware3) - ) - ) - ->route(Route::get('/{slug}/{key}/{subKey}', 'yet_another_route', $handler) - ->pathOptions(['tokens' => ['slug' => '[a-z]+', 'key' => '[a-z]+', 'subKey' => '[a-z]+']]) - ->middleware($middleware2) - ) -; -``` - -### to - -```php -Group::create('/{id}', [ - Route::get( - '/{slug}', - 'element_read', - $handler, - [$middleware2], - ['tokens' => ['slug' => '[a-z]+']] - ), - Group::create('/{slug}', [ - Route::get( - '/{key}', - 'another_route', - $handler, - [$middleware3], - ['tokens' => ['key' => '[a-z]+']] - ), - ], [$middleware2], ['tokens' => ['slug' => '[a-z]+']]), - Route::get( - '/{slug}/{key}/{subKey}', - 'yet_another_route', - $handler, - [$middleware2], - ['tokens' => ['slug' => '[a-z]+', 'key' => '[a-z]+', 'subKey' => '[a-z]+']] - ), -], [$middleware1], ['tokens' => ['id' => '\d+']]); -``` - -The router `Chubbyphp\Framework\Router\RouterInterface` was splitted into: - * `Chubbyphp\Framework\Router\RouteMatcherInterface` (match routes) - * `Chubbyphp\Framework\Router\UrlGeneratorInterface` (generate url) - -Move of `Chubbyphp\Framework\Router\RouterException` to `Chubbyphp\Framework\Router\Exceptions\RouterException`. - -`RouteGenerationException` replaces - * `Chubbyphp\Framework\Router\Exceptions\MissingAttributeForPathGenerationException` - * `Chubbyphp\Framework\Router\Exceptions\NotMatchingValueForPathGenerationException` - -## ErrorHandler - -ErrorHandler will be removed (convert php error to exception), cause it forces exceptions -in libraries `trigger_error` is used without silence it. See: https://github.com/lcobucci/jwt/issues/563 -If you don't mind i suggest to copy the code from 3.x to your project, adapt the namespace and use your implementation. - -## Application - -Construct signature changes (only relevant if you override the defaults) -from `($middleware, $middlewareDispatcher, $emitter)` -to `($middleware, $middlewareDispatcher, $requestHandler, $emitter)` diff --git a/doc/Migration/Slim-Chubbyphp.md b/doc/Migration/Slim-Chubbyphp.md index 8f78d2d..c3c10fd 100644 --- a/doc/Migration/Slim-Chubbyphp.md +++ b/doc/Migration/Slim-Chubbyphp.md @@ -31,6 +31,8 @@ $app->run(); ## Chubbyphp +Requires `chubbyphp/chubbyphp-framework` `^3.5` and `chubbyphp/chubbyphp-framework-router-fastroute` `^1.2`. + ### Keep Controller (RequestHandler) signature ```php @@ -47,7 +49,8 @@ use Chubbyphp\Framework\RequestHandler\SlimCallbackRequestHandler; use Chubbyphp\Framework\Router\FastRoute\RouteMatcher; use Chubbyphp\Framework\Router\Route; use Chubbyphp\Framework\Router\Routes; -use Psr\Http\Message\ServerRequestInterface; +use Psr\Http\Message\ResponseInterface as Response; +use Psr\Http\Message\ServerRequestInterface as Request; use Slim\Psr7\Factory\ResponseFactory; use Slim\Psr7\Factory\ServerRequestFactory;