First of all, Java can give you definitely better speed, especially at scale. One benefit is that you can tune it for a better response time, and another one is when you'll have millions of requests per day it'll save you some infrastructure cost.
But.. will you have millions of requests a day? How much does it matter if the API response time is 10ms or 50ms?
Rewriting an existing project is a huge deal. It can take years(!), especially if the team hasn't done such a thing yet and especially if the tech stack gets completely replaced.
So I argue against rewrite in the first place. There are two older articles on the topic, but their arguments are both valid as of today:
What I'd suggest instead is to learn refactoring strategies. Even if you have some routine with refactoring it is worth reading Fowler's refactoring book: https://book-programming.com/refactoring-books/
What I would do with a "frameworkless" PHP codebase is:
- Add a framework (I would also go with Laravel, but Symfony or Phalcon would also do the job)
- Isolate the existing codebase in a folder if possible without any actual changes
- Route the requests through the framework (with a catch-all route) and forward the request to the existing codebase
- Take a simple component/page to start with and replace the DB calls using Laravel's DB layer
- Doing this "experiment", you'll have a strategy that you can apply to other components
- Do the refactoring for views, controllers, etc, step by step
- In case you have APIs and other kinds of components apply different strategies
- Keep deploying as frequent as possible
- Apply the learnings on the run and do pivots if needed
There are many more details to this, but it exceeds the scope of this answer.
About Java: last year I was part of, actually sparking the rewrite of an existing API from Symfony to Java using Spring Boot/JHipster. The bottom line is that it was a bad idea.
We had a separate PM, an Engineering Manager, and a set of developers both Java and PHP, one of the developers highly experienced with the JHipster stack. We've got the support of the CEO, and despite his strong worries, the Head of Software gave it a green light too.
After 20 months the old PHP system is still running and - of course - it has more features than the Java one, because life didn't stop, business demanded new features in the live system.
Java and the whole ecosystem are very different, so even if you have people with battlefield experience with it, the complete rewrite is extremely risky.
In my opinion, it's less of a technical than a business decision. I would sit down with the person(s) paying the bill for the refactoring. I would phrase the following questions and elaborate the answer together with them:
- What is the problem we want to solve? (maintainability? speed? lack of people understanding the system? security?)
- Is the system legacy only technically or also in the meaning "it no longer fits the business' reality"?
- What are the expected outcomes of the refactoring?
- What is the budget for the new/refactored system?
- What is the timeframe allowed for the refactoring/rewrite?
- How does the rewrite compare to refactoring, in terms of time, money, and complexity?
- What happens with the development of new features during refactoring?
- What resources will be assigned to the refactoring project?