@akrabat and @geggleto Did either of you have ideas for this one?
My thoughts are that we need to decouple the App and Rendering Content to the browser.
run method takes a Request object and returns a Response object, and in 4.x we mark __invoke as deprecated and fully remove in 5.x. __invoke then becomes a proxy of run() in 4.xReasoning:
Isn't __invoke there so you can run the App itself as a middleware?
Are you planning on removing that functionality entirely or will you replace it with process(ServerRequestInterface $request, DelegateInterface $delegate)?
@geekish has a good point
@geekish @codeguy We can still support it as middleware if our users need it. I have never seen Slim used in such a manner unless it was to facilitate unit/integration tests. Which should be fixed by more decoupling of the internals.
The use case I have in mind is best explained here:
https://zendframework.github.io/zend-expressive/cookbook/common-prefix-for-routes/
Might be time for me to test the differences between using route groups and apps as middleware.
I use the __invoke method inslide the CLI front controller
// ...
echo $app($request, $response)->getBody();
Going off of my earlier comments, in my testing the __invoke method is only usuable as a middleware inside of Slim. I had to make a wrapper class that calls the current process method instead. I would like to Slim as an actual middleware itself.
run() and __invoke() have totally different purposes:
We can't consolidate as they perform different functions within the lifecycle.
We will need to look at __invoke when we go to PSR_15 though.
Most helpful comment
Going off of my earlier comments, in my testing the __invoke method is only usuable as a middleware inside of Slim. I had to make a wrapper class that calls the current process method instead. I would like to Slim as an actual middleware itself.