Announcement Announcement Module
No announcement yet.
Any demos of PHP integrated with Spring? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Any demos of PHP integrated with Spring?

    It appears as though PHP can be setup within a servlet container. With so many projects using PHP, has anyone had any luck with integrating PHP with Spring?

  • #2
    There are a variety of remoting protocols that Spring supports, and you should be able to chose from several supported in PHP. Acegi Security also offers CAS integration, which allows single sign on, and there is a PHP client as well so you can make the authentication step cross-platform.

    One remoting protocol that I think had particular promise in this era of increasing AJAX deployments is I've used this with Spring's DataBinder to automate "complex" POJO creation on the Java end and translation to JSON for the client.


    • #3
      Check out Java's JSR 223.

      It is allows multiple scripting languages to run embedded in a servlet conatiner. One of the main languages used for the specification was PHP.

      I was able to get the reference implementation installed in tomcat it about 5 minutes. Then it only took me another 5 minutes to get access to the spring WebApplicationContext.

      $webAppUtil = new JavaClass("") ;
      $wac = $webAppUtil->getWebApplicationContext($request->getSession()->getServletContext()) ;
      $playBean = $wac->getBean("playBean") ;
      echo $playBean->sayHello() ;
      This is a much better way to bridge PHP and Java because it totally eliminates the remoting overhead with using springs remoting support.


      • #4
        Wow !!! Does that mean that, with that JSR, you can use PHP for the presentation layer, on top of a Spring/Hibernate business/data architecture ?!!!


        • #5
          That is exactly what it means. This is a big step for PHP in the enterprise. I will be interested to watch this JSR mature.


          • #6
            Wahooo... after Object to Relational mapping, scripting to object mapping ! Yes I know PHP5 is fully OO but wow it's interpreted. The best of both worlds, compiled code for business reusable code, and interpreted PHP (instead of bad compiled on-the-fly JSP's) for page generation. That would definitely rock. Thank you for the intel. I'll follow that up too.