PHP on Java 
      
     
      
       <ul>
        
         <li>Dads 
        
        
         <li>ad ...

      
       PHP ? 
      
     
      
       “ PHP isn't so much a language as a   virtual explosion  at the  keyword ...

      
       PHP ? 
      
     
      
       in_array( $needle ,  $haystack ); 
       strpos( $haystack ,  $needle );...

      
       PHP ! 
      
     
      
       
       
      
     
      
       
      
     
      
       
      
 ...

      
       PHP ! 
      
     
      
       
       
      
     
      
       
      
     
      
       Photo fro...

      
       PHP ! 
      
     
      
       
       
      
     
      
       
      
     
      
       
      
 ...

      
       Why  integrate PHP and Java?  
      
     
      
       
       
      
     
      
       <ul>
        ...

      
       Why  run PHP  on the  JVM ?  
      
     
      
       
       
      
     
      
       <ul>
        
...

      
       How  PHP  runs on the  JVM 
      
     
      <?php 
      echo  'hello' ; 
      
       
       
       ...

      
       How  PHP  runs on the  JVM 
      
     
      
       <ul>
        
         <li>P8: a PHP 5.2 runtime imp...

      
       Some  Code ! 
      
     
      <?php 
      java_import( &quot;java.util.HashMap&quot; ); 
      $map  = ...

      
       Some more  Code ! 
      
     
      <?php 
      java_import( &quot;java.io.File&quot; ); 
      
      c...

      
       Last bit of  Code ! 
      
     
      <?php 
      java_import( &quot;java.util.ArrayList&quot; ); 
     ...

      
       PHP apps  +  Java libraries 
      
     
      
       <ul>
        
         For example... 
         
  ...

      
       Java apps  +  PHP scripting 
      
     
      
       
       
      
     
      
       <ul>
        
 ...

      
       PHP in  WebSphere sMash 
      
     
      
       
       
      
     
      
       <ul>
        
     ...

      
       Sorry, one more bit of   Code ! 
      
     
      
       
      
     
      
       
      
     
     ...

      
       PHP in  Message Broker 
      
     
      
       
       
      
     
      
       
       
      
    ...

      
       PHP in  CICS 
      
     
      
       
       
      
     
      
       <ul>
        
         Build R...

      
       Learn  more & Try  it out: 
      
     
      
       
       
      
     
      
       
       
       ...
Upcoming SlideShare
Loading in...5
×

PHP on Java (BarCamp London 7)

11,466

Published on

PHP on Java: why it makes sense to run PHP on the Java Virtual Machine.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
11,466
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
25
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • PHP on Java (BarCamp London 7)

    1. 1. PHP on Java <ul> <li>Dads <li>ad </ul> Robin Fernandes (ibm) [email_address] @rewbs
    2. 2. PHP ? “ PHP isn't so much a language as a virtual explosion at the keyword and function factory .” - Jeff Atwood from “PHP sucks, but it doesn't matter”
    3. 3. PHP ? in_array( $needle , $haystack ); strpos( $haystack , $needle ); ... IteratorIterator RecursiveIterator RecursiveIteratorIterator ... strip _ tags() strip s lashes() SDO _ Model _ Property::get C ontaining T ype() ReflectionClass::isItera tea ble()
    4. 4. PHP ! tiobe.com
    5. 5. PHP ! Photo from DragonBe
    6. 6. PHP !
    7. 7. Why integrate PHP and Java? <ul> <li>PHP Developers to grow from 3 to 5.5 million by 2013 <li>PHP Developers in Corporate IT to grow from 13% to 60% by 2013 </ul> “ Pay special attention to opportunities to use PHP in combination with Java development efforts” <ul> - Gartner </ul>
    8. 8. Why run PHP on the JVM ? <ul> <li>PHP is an awesome language for web dev <li>The Java Virtual Machine is a cutting edge language runtime </ul> PHP + JVM = ♥
    9. 9. How PHP runs on the JVM <?php echo 'hello' ; System. out .println( &quot;hello&quot; );
    10. 10. How PHP runs on the JVM <ul> <li>P8: a PHP 5.2 runtime implemented in Java <li>Runs on any Java 5+ JDK </ul> <ul> Extensibility <ul> <li>XAPI-C for existing C extensions <li>XAPI-J for new Java extensions </ul> (extension language choice is opaque to scripts) <li>Debug via DBGp using Eclipse PDT </ul> P8 Runtime SAPI-J Parser Interpreter P8 Engine Java Extensions C Extensions Stack Resources Classes Objects Variables AST XAPI-J XAPI-C Native code Compiler .class opcodes Cache Persistent class cache Debug API (DBGp) Runtime
    11. 11. Some Code ! <?php java_import( &quot;java.util.HashMap&quot; ); $map = new HashMap; $map ->put( &quot;stuff&quot; , array ( 1 , 2 , 3 , 4 , 5 )); var_dump( $map ->get( &quot;stuff&quot; )); // prints: array(5) { ...
    12. 12. Some more Code ! <?php java_import( &quot;java.io.File&quot; ); class SubFile extends File { function isThisCool() { return TRUE ; // Way cool } } $file = new SubFile( &quot;/&quot; ); var_dump( $file ->isDirectory()); var_dump( $file ->isThisCool());
    13. 13. Last bit of Code ! <?php java_import( &quot;java.util.ArrayList&quot; ); $list = new ArrayList(); $list ->add( &quot;Hello World!&quot; ); $list ->add( FALSE ); $list ->add( 1234567890 ); foreach ( $list as $key => $value ) { echo &quot; $key $value &quot; ; }
    14. 14. PHP apps + Java libraries <ul> For example... <ul> <li>SugarCRM + Apache POI <li>Drupal + Eclipse BIRT <li>PhpBB + Apache Lucene <li>Your PHP app + ??? = profit </ul> </ul>
    15. 15. Java apps + PHP scripting <ul> For example... </ul>
    16. 16. PHP in WebSphere sMash <ul> Build Web apps quickly and easily in Java , Groovy and PHP . </ul> <ul> <li>“ The application is the server” <li>Lightweight runtime, not a Java EE environment <li>Browser-based development tooling </ul> JVM Web Server Application Code Language Runtimes
    17. 17. Sorry, one more bit of Code ! class Dynamic { def storage = [:] def invokeMethod(String name, args) { println &quot;Hello!&quot; } def getProperty(String name) { storage[name] } def setProperty(String name, value) { storage[name] = value } } <?php groovy_import( &quot;dynamic.groovy&quot; ); $foo = new Dynamic(); $foo ->bar(); $foo ->guff = &quot;Hello World!&quot; ; echo $foo ->guff;
    18. 18. PHP in Message Broker <ul> <li>Message Broker “ connects anything to anything ” <li>Routes and transforms data along the way <li>Use graphical mapping, XSLT, ESQL, Java and now PHP ! <li>With PHP, use a SimpleXML-inspired syntax to easily manipulate XML message formats. </ul>
    19. 19. PHP in CICS <ul> Build RESTful services based on CICS assets using PHP </ul> Transaction Server CICS assets: RESTful API to CICS assets SupportPac CA1S ... DB2 COBOL Java
    20. 20. Learn more & Try it out: http://projectzero.org/php Thanks! [email_address] / @rewbs
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×