Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How create sub request in phalcon

How can you get this functionality in Phalcon 3?

http://silex.sensiolabs.org/doc/master/cookbook/sub%5requests.html

$response = $app->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false);
edited Oct '16

$response = $app->handle("/someUrl")

Or just extends phalcon Request, add setters to it, then create new request, set whatever you want, add it do di and do $app->handle()



46.6k
Accepted
answer

@Jurigag: I guess it's not about routing nor handling primary request, it's about "sub request", a term which does not exist in a HTTP world, but closest thing to this Symfony approach would be Disaptcher in Phalcon.

Since Silex is based on the HttpKernelInterface, it allows you to simulate requests against your application. This means that you can embed a page within another, it also allows you to forward a request which is essentially an internal redirect that does not change the URL.

Basically, they inject entire HTTP request into another 'route', which is then handled by some other controller/script. In Phalcon, you don't even need to do it as there is a shared Request service.

edited Oct '16

I'm using micro and you can not use the dispatcher.

I'm looking for a way to make widgets, any ideas?

It does not seem a good idea to sub-request, I will follow the advice of @stamster and I will create another discussion on the topic of widgets and blocks.