Results 1 to 6 of 6

Thread: Any demos of PHP integrated with Spring?

  1. #1
    Join Date
    Jun 2005
    Location
    Dallas, Texas
    Posts
    19

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    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 http://oss.metaparadigm.com/jsonrpc/. 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. #3
    Join Date
    Jun 2005
    Posts
    4

    Default

    Check out Java's JSR 223.

    http://www.jcp.org/en/jsr/detail?id=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.

    Code:
    $webAppUtil = new JavaClass("org.springframework.web.context.support.WebApplicationContextUtils") ;
    
    import_request_variables("P");
    
    $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. #4
    Join Date
    Apr 2005
    Location
    Brussels, Belgium
    Posts
    100

    Default

    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 ?!!!
    Sebastien Arbogast

  5. #5
    Join Date
    Jun 2005
    Posts
    4

    Default

    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. #6
    Join Date
    Apr 2005
    Location
    Brussels, Belgium
    Posts
    100

    Default

    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.
    Sebastien Arbogast

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. Replies: 5
    Last Post: Aug 9th, 2008, 05:30 AM
  3. Gaijin Studio for Spring MVC 0.9.2 Released
    By dadams in forum Announcements
    Replies: 8
    Last Post: May 30th, 2007, 10:48 PM
  4. A Spring Class Loader?
    By azzoti in forum Architecture
    Replies: 8
    Last Post: May 7th, 2005, 04:02 AM
  5. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •