Prepare Objectiveweb Router v3.0.0 - #1
Open
objectivebot wants to merge 60 commits into
Open
objectivebot wants to merge 60 commits into
objectivebot wants to merge 60 commits into
Conversation
While initializing Attributes with Dice, linting got broken since the Attribute misses the arguments that will be injected by DI. This changes syntax to calling #[Middleware(class, ...args)] instead of referencing the Attribute directly.
- Instantiate from Router - Set template.root and default middlewares in Router
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prepare Objectiveweb Router 3.0.0 as an intentionally breaking release.
This PR modernizes the supported runtime and test matrix, hardens controller/middleware/response behavior, fixes template handling, and adds the release metadata and verification needed for a public v3 release.
Breaking changes
Dice\\Dice.addRule()andcreate(string $name, array $args = []): objectare the supported Router DI API.shareargument is not exposed by Router.before()/beforePost()hooks with attribute-based middleware.before()must return the complete controller argument array.respond()pipeline.<composer project root>/templates.See
CHANGELOG.mdfor detailed migration notes from 2.x.Runtime and response handling
respond()dispatch so Router subclasses can override response handling.respond().Middleware
before()hooks in declaration order.after()hooks in reverse order.after()hook.before()results with a clear 500 error.MiddlewareInterfaceand middleware documentation accordingly.Templates
Dependencies and CI
Composer resolves
objectiveweb/dicefrom the published package; the temporary VCS repository override has been removed.Require PHP 8.1+.
Require published Objectiveweb Dice
^4.1.0.Support PHPUnit 10-12.
Update JMS Serializer development compatibility to
^3.32.Remove Travis CI.
Add GitHub Actions CI for PHP 8.1, 8.2, 8.3, 8.4, and 8.5.
Run
composer validate --strictin CI.Add a release verification workflow for
v*tags and manual runs, including:--no-devdependency install check.Release metadata
LICENSE.CHANGELOG.mdwith v3 changes and 2.x → 3.x migration notes.Verification
Current
develCI is green on:This release does not attempt to maintain backwards compatibility with Router 2.x.
Content negotiation
Acceptmedia ranges with q-values and wildcards.Acceptis missing or equally weighted.text/html; charset=utf-8orapplication/json; charset=utf-8instead of inferring content type from the first response byte.Vary: Acceptwhen a response has multiple possible representations.Error boundary
Throwablefailures at the route boundary, includingTypeError,ArgumentCountError,ValueError, andError.0to HTTP 500.Throwablevalues with the standard JSON error envelope.Request body handling
Content-Typeinstead of guessing from the payload shape.application/jsonand structuredapplication/*+jsonmedia types.Error response negotiation
text/htmlandapplication/json.Deprecation policy
--fail-on-deprecation --display-deprecationsso CI fails if PHP/PHPUnit deprecations reappear.Release workflow verification
actions/checkout@v7.composer install --no-devjob against published dependencies.v*tags and manual dispatch.Verb helper dispatch
GET(),POST(),PUT(), andDELETE()through the same callback resolver and Throwable boundary asroute().[ClassName::class, 'method']callbacks consistently from verb helpers.Documentation and examples
level-2/diceincludes and use Composer autoloading in runnable examples.before()/beforePost()examples in favor of attribute middleware.MiddlewareInterface.Productobjects rather than incompatible arrays.Middleware DI instantiation
shareargument when constructing middleware.shared => true, including the same shared dependency being reused by the controller and repeated middleware instances.DI API boundary
Router::create()tocreate(string $name, array $args = []): object.shareargument through the Router API.Global request middleware and CORS
before()hooks run once before route matching and whoseafter()hooks unwind when a route produces a response.RequestMiddlewareInterfacewith request-levelbefore(method, path)andafter(method, path, response)hooks.before()hooks once per incoming request in declaration order, before route matching; runafter()hooks in reverse order around the routed response.addRequestMiddleware()andrequest.middlewaresconstructor configuration.CorsMiddleware.setCors()registerCorsMiddlewareinstead of using controller-specific CORS branching.Basic HTTP method semantics
PATCH()helper with the same request-body parsing as POST/PUT.GET()accept HEAD requests and make controller HEAD requests resolve through GET/index/custom GET methods.route()patterns remain literal regex behavior, and route-table features such as synthesized global 405/Allow and generic OPTIONS are not inferred automatically.Template hardening
Template::render(): stringexplicit.extract(..., EXTR_SKIP)so template data cannot overwrite renderer locals.$_contentsfrom user-supplied data.