I have a legacy app that was built on top of an older-version OsTicket. OsTicket is essentially its own framework with authentication, authorization, usernames, session handling, etc. with all the legacy artifacts such as $_SESSION, $_GET, $_POST, including some old jQuery and JS AJAX code. Every path is a hardcoded URL, in PHP, HTML, and AJAX. It is also an app with a bad design, god objects, spaghetti code, and global variables, and lack of separation of concerns.
I need to port this app to Mezzio
I started rewriting the app using Mezzio stack, hoping that I could port some of the existing code over, but I am finding that I have to rewrite or build from scratch pretty much everything - every hardcoded legacy URL needs to be routed to a new URL, and each requires a Handler & in some cases, Handler Factory . There are thousands of URLs for which I need to create Request Handlers and make the updates. For each Request Handler, I can’t simply port legacy code, I have to read it for comprehension, extract relevant HTML that is intermixed with PHP code and database code, and port them into .phtml. I also need to separate concerns, since for example, Mezzio does not allow one to echo
or print
output from the handler, where legacy code did whatever it wanted without punishment. I need to separate database code as well and work with all of the legacy code artifacts that you could image.
The goal is to get rid of OsTicket stack and use Mezzio stack and do it in a relatively short time frame. Going about it brute force way, as I described above, is getting to be prohibitively expensive and is taking a long time.
What can I do, what are my options?
Is there an option to run my OsTicket app as part of Mezzio as an intermediate step that will work now while I could take a longer time for refactoring to full Mezzio stack later? Is that going to be the best way? If yes, what is the process to make it happen?
Is the best way to bite the bullet and keep refactoring to Mezzio?
Is there something else I haven’t thought of? Has someone dealt with ugly legacy code and successfully moved it to Mezzio?