Question

I have a few modules of an application that have been written in Java. But now, I have been asked to write all the other modules in PHP.

Is there any tool that will permit me to make method calls from PHP to Java and vice versa?
If not, is it possible to develop one especially considering the fact that Java is a strongly typed language unlike PHP?

Was it helpful?

Solution

Without knowing more I would suggest that you expose the Java methods as a web service. This has a number of other benefits outside of just language independent consumption.

However, web services might not be the answer if your java modules are very granular.

OTHER TIPS

You might find it easiest if you use one of the solutions that enables you to run PHP on the JVM. This should give you pretty good interoperability. e.g.

Having said that, if you're already using Java modules, I can't see a huge amount of value in adding PHP into the mix as well. Why not just stick with Java? Java is already pretty much the best all-round platform choice for server side applications once you consider things like library ecosystem, tools, portability, performance, maturity, maintainability etc.

You can use nice frameworks like Play (Java/Scala) or Grails (Groovy) or Noir (Clojure) if you want productive web development on top of the Java stack, I think I would choose these in preference to most of the PHP frameworks available.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top