I thought using the RouteStrategy might be a solution. but its gona all ford on us “You can have the car in any colour as long as its black” Routing - Slim Framework routing strategy must be an interface that has the same pattern (request, response, args)
You can provide your own route strategy by implementing the Slim\Interfaces\InvocationStrategyInterface.
interface InvocationStrategyInterface
{
/**
* Invoke a route callable.
*
* @param callable $callable The callable to invoke using the strategy.
* @param ServerRequestInterface $request The request object.
* @param ResponseInterface $response The response object.
* @param array<mixed> $routeArguments The route's placeholder arguments
*
* @return ResponseInterface The response from the callable.
*/
public function __invoke(
callable $callable,
ServerRequestInterface $request,
ResponseInterface $response,
array $routeArguments
): ResponseInterface;
}
Im not too sure how you could use that to supply your own strategy when all 3 the options are pretty much covered. args from params, args from attributes, args as an array/.
What benefits do you get for switching to nyholm/psr7? (Im interested since ive been told “you loose the benefit of psr7 if you customize anything” but to me if the psr follows the psr it should pretty much “do the same thing”. Unless each library then adds something like in my case setup a whole psr7 library to be able to inject the ->get() thing ive spoken about. in which case the first time you use that ->get() in code makes it that you “loose the benefits of psr7” so a catch 22. Or am i totally confusing things here?