This document discusses using PHP to build rich internet applications (RIAs). It provides examples of using PHP to return XML or JSON data to an RIA client, and using AMFPHP to transfer PHP objects directly to ActionScript clients. It recommends building PHP apps as services that can be consumed by any front-end technology, including Ajax, XAML and Flex, in order to simplify the PHP code.
26. To Think About
• Reach - How many people will view this
application? What platform will they be on?
Is it an open or closed platform?
• Rich - Can I integrate rich content easily,
like video, audio and animations?
• Tools - What will I use to build this
application? How will I debug?
28. REST with PHP
<?php
//connect to the database
mysql_connect ...
//get the data
mysql_query( “SELECT * from recipes”);
...
//transform into XML
print “<recipes><recipe id=’1’ name=’cake’/><recipe id=’2’
name=’hotdog’/></recipes>”;
?>
29.
30.
31. PHP and RIAs
• Transfer PHP objects to the client directly
• JSON - JavaScript Object Notation
• AMF - ActionScript Messaging Format
37. Flex with AMFPHP
<?php
//connect to the database
mysql_connect ...
//get the data
$ResultObject = mysql_query( “SELECT * from recipes”);
...
return( mysql_fetch_object( $ResultObject ) );
?>
40. Recap
• Build PHP apps as services that can be used
by any front end - Ajax, XAML, Flex etc...
• Rich clients and components allow you to
simplify your PHP code
42. Web Compiler for
Flex Applications
• http://labs.adobe.com
• Allows you to create MXML, ActionScript,
upload to the server and compile there,
similar to developing PHP applications
43.
44. Apollo enables...
• Offline / Occasionally Connected
• Applications can run in background
• Network
• HTTP
• XML-RPC / SOAP / Rest based web services
• Binary and XML sockets
• File I/O
• Local storage / Settings API
• Custom Chrome
• Shape
• Alpha