Background: I have a legacy app that serves files as-is. That is, i.e. when I go to http://server/subfolder/my_index.php?value=x
it goes into subfolder
on the file system and serves a file called my_index.php
and passes it the URL parameters and returns a response.
I want to move onto ZF3 stack, and routing there is different. I want to retain ZF routing model for new modules on ZF3, but also be able to use the legacy app as-is, since rewriting that app is prohibitive.
Is there a way to do so?
Not sure if it is the way to do it but I looked into the Middleware layer here:
- https://docs.zendframework.com/zend-mvc/middleware/ and
- https://zendframework.github.io/zend-diactoros/usage/
I am not clear on how to use them and if they will help me.
For example, I set up this class and not sure what to do next.
namespace Application\Middleware;
use Psr\Http\Message\ServerRequestInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Zend\Http\Response;
class IndexMiddleware implements MiddlewareInterface
{
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
{
$response = new \Zend\Diactoros\Response();
return $response;
}
}