PHP on Java (BarCamp London 7)
Upcoming SlideShare
Loading in...5
×
 

PHP on Java (BarCamp London 7)

on

  • 6,829 views

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

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

Statistics

Views

Total Views
6,829
Views on SlideShare
6,827
Embed Views
2

Actions

Likes
2
Downloads
24
Comments
0

2 Embeds 2

http://www.slideshare.net 1
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

PHP on Java (BarCamp London 7) PHP on Java (BarCamp London 7) Presentation Transcript

  • PHP on Java
    • Dads
    • ad
    Robin Fernandes (ibm) [email_address] @rewbs
  • 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”
  • 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()
  • PHP ! tiobe.com
  • PHP ! Photo from DragonBe
  • PHP !
  • Why integrate PHP and Java?
    • PHP Developers to grow from 3 to 5.5 million by 2013
    • PHP Developers in Corporate IT to grow from 13% to 60% by 2013
    “ Pay special attention to opportunities to use PHP in combination with Java development efforts”
      - Gartner
  • Why run PHP on the JVM ?
    • PHP is an awesome language for web dev
    • The Java Virtual Machine is a cutting edge language runtime
    PHP + JVM = ♥
  • How PHP runs on the JVM <?php echo 'hello' ; System. out .println( &quot;hello&quot; );
  • How PHP runs on the JVM
    • P8: a PHP 5.2 runtime implemented in Java
    • Runs on any Java 5+ JDK
      Extensibility
      • XAPI-C for existing C extensions
      • XAPI-J for new Java extensions
      (extension language choice is opaque to scripts)
    • Debug via DBGp using Eclipse PDT
    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
  • 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) { ...
  • 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());
  • 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; ; }
  • PHP apps + Java libraries
      For example...
      • SugarCRM + Apache POI
      • Drupal + Eclipse BIRT
      • PhpBB + Apache Lucene
      • Your PHP app + ??? = profit
  • Java apps + PHP scripting
      For example...
  • PHP in WebSphere sMash
      Build Web apps quickly and easily in Java , Groovy and PHP .
    • “ The application is the server”
    • Lightweight runtime, not a Java EE environment
    • Browser-based development tooling
    JVM Web Server Application Code Language Runtimes
  • 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;
  • PHP in Message Broker
    • Message Broker “ connects anything to anything ”
    • Routes and transforms data along the way
    • Use graphical mapping, XSLT, ESQL, Java and now PHP !
    • With PHP, use a SimpleXML-inspired syntax to easily manipulate XML message formats.
  • PHP in CICS
      Build RESTful services based on CICS assets using PHP
    Transaction Server CICS assets: RESTful API to CICS assets SupportPac CA1S ... DB2 COBOL Java
  • Learn more & Try it out: http://projectzero.org/php Thanks! [email_address] / @rewbs