@gerardnll You can’t change method-logic injection like that.
If you want to read how Stripe actually versions their API, then you can read the blog post they published on the topic: https://stripe.com/blog/api-versioning
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have an API, and currently it is on the V1. Major changes to routes, for example, may provoke a change in the API major version number, but this is not the case now.
What I want is, to do as Stripe does, use a date to also define API versions, for example '2022-01-01'. Normally, this version changes affect responses and requests to the API. In this case I want to change my Request class depending on the received API Version (or use a default).
I would like to know how I can do something like this:
Controller:
public function update(UpdateReviewGatheringRequestContract $request, Review $review): ReviewResource
{
// Update review
}
So i have various request files, that handle the request differently but all extend that contract (and FormRequest).
App\Http\Requests\V1\V20210701\UpdateReviewGatheringRequest App\Http\Requests\V1\V20220101\UpdateReviewGatheringRequest
Thanks
Please or to participate in this conversation.