We want to switch to using Laravel, but we already have a full single entry point custom application. Our first step of refactoring is to put the entire legacy application in a top-level root folder called 'legacy'. The legacy app can easily be initialized and ran with few lines of code, we've tested this inside laravel already and it worked fine.
The issue is that for a start Laravel will do nothing but be the single entry point and have nothing to route to until further refactorings are done. So on the main index.php file we want Laravel to have some kind of logic that says,
"If I don't have anything to route to, load and run the legacy application to complete the request.". This way as we refactor pieces and provide routing Laravel can handle new pieces we add accordingly and always fall back on our legacy application to do any remaining work Laravel has not been set up to do as we refactor new components in. We'll also be including our library code in Laravel as well.
Any suggestions on how to achieve this? Is there a way to check the Laravel framework to see if it can successfully route the request anywhere or check for a 404 then call our application? We need to run both until we perform a full refactoring and it can take a while.
Our application is a single entry point and can easily be put inside other applications or frameworks.