Uh oh!
There was an error while loading. Please reload this page.
Feat: support multiple methods per route via Http::routes() - #259
Feat: support multiple methods per route via Http::routes()#259ChiragAgg5k wants to merge 12 commits into
Conversation
k6 benchmark
|
Greptile SummaryThis PR introduces
Confidence Score: 5/5Safe to merge; atomicity of multi-method registration and alias registration is correctly enforced by pre-validating all methods before touching the routes table. The core correctness concern for this feature — partial route registration when one of N methods conflicts — is handled in both src/Http/Route.php — the new Important Files Changed
Reviews (9): Last reviewed commit: "Fix Docker test image file list" | Re-trigger Greptile |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ChiragAgg5k
commented
Jun 10, 2026
Closing this mirror PR because the change has been merged through the monorepo: utopia-php/monorepo#1 |
What does this PR do?
Adds
Http::routes()so one route handler can be registered for multiple HTTP methods:This supports endpoints such as OpenID Connect UserInfo, where the same endpoint must accept both GET and POST, without duplicating route actions or adding another alias-specific public API.
Implementation
Http::routes(string|array $methods, string $url): Route.Http::get(),post(),put(),patch(), anddelete()as single-method wrappers aroundroutes().Route; the first method remains the primary method for backwards compatibility.Route::getMethods()for route metadata and keepsRoute::getMethod()as a deprecated compatibility accessor.Routeinstance.Http::routes([GET, POST], '/new')->alias('/old')matches both methods under both paths.Test plan
vendor/bin/phpunit --configuration phpunit.xml tests/RouteTest.php tests/RouterTest.php tests/HttpTest.phpcomposer format:checkcomposer analyzeNote: the full PHPUnit suite includes FPM/Swoole e2e tests that require
fpmandswoolehosts; those were not available in the local shell environment.Have you read the Contributing Guidelines on issues?
Yes