In the August 2007 edition of Linux Magazine, the editor contributes an article about the usefulness of integrating PHP with the free Flex SDK to achieve a Rich Internet Application (RIA) in a Web 2.0 world.

Flex and PHP
by Martin Streicher
Linux Magazine (full article available online with free registration)

The author begins by a short comparison of the RIA technologies of AJAX vs. Flex, and goes on to suggest that while AJAX is touted as an alternative to Flex UI's, AJAX suffers from a lack of rich media integration such as video, music, or animations and carries the risk of varying JavaScript behavior across different browser implementations.

The article does a great job describing architectural differences between classic web applications and RIAs. In a multi-tiered Rich Internet Application the application server technology such as PHP, or better yet ColdFusion, acts as the controller to implement business logic and interacts with deeper service layers that interface with the database. However, on the client side, Flex runs in the browser to perform data input validation, displays data visually via drill-down charts and graphs or via paginated data grids, and provides real time updates to changes in data (via Live Cycle Data Services a.k.a. Flex Data Services).

Furthermore, Flex provides a smart looking user interface and seamless user experience akin to typical desktop software while lacking the notoriously painful white screens of death during page refreshes that are commonplace in the Web 1.0 world. In effect, more work is done in the browser as a means of distributed computing, leaving the application server to focus on business logic and freeing it from having to generate the UI again and again across requests.

the role of the Web server is greatly simplified, limited to data manipulation (read/write) and computation. The servers output is neutral XML. On the client, the browser runs the Flash application in an isolated Flash Player environment. The Flex application which could be a single element in a larger, traditional Web page or a complete Web site renders the user interface, reacts to mouse clicks and other input events, and changes from one interface screen to another (the various states of a user interface are called view states in the parlance of Flex). The Flex application is stateful, unburdening the server from rework. The style, content, and visuals of the application are essentially boundless, limited to the capabilities of the Flash Player. And the application runs consistently on any platform that Flash Player has been ported to, including Linux, Mac OS X, and Windows.

When developing Flex applications, Flex Builder is the preferred IDE, capable of code-centric or drag-n-drop development styles. Development is simple, just create a Flex project, click Run to automatically compile the code and run it in a browser, or when needed set break points and run the app in debug mode. When finished all that needs to be done is to push the resultant swf file into testing and production.

The application server technology shares data with the Flex front end via several protocols including most simply HTTP requests for static or dynamically generated XML, SOAP-based Web Services, or can interact directly with server components (servlets, CFCs, or whatever the PHP equivalent is) via the more efficient AMF protocol.

A common complaint of Flex-based RIAs or widgets is their homogenous appearance with the default white panels on a graded silver background (the "naked skin"), but this is more the fault of developers so far than of the Flex technology since Flex provides a means for customizable skinning and themes, although developer rarely utilize it. The team at ASFusion have stepped up to encourage creative skinning among Flex developers with their new site Fill Colors.

I'd like to announce the release of our latest project, Fill Colors! As many of you know, Nahuel and Laura have been passionate users and fans of Adobe Flex from its beginning. With Fill Colors, we really want to explore and push the possibilities of what is possible with Flex. Having grown tired of the default Flex style, we wanted to manipulate the look and feel of a Flex application. [Read More]

Wrapping up the Linux Magazine article, the author suggests that you may want to dip your toe in the water before diving in, and one can begin by replacing parts of existing Web 1.0 type applications with small RIA widgets. Gradually, a multipage application can become Flex-ified little by little. New projects can be written to run full screen with Flex as a single web interface.

Those who commented on the online article at Linux Magazine seemed to have not read the article, but don't let their ignorance distract you from the quality of this well written introduction to Flex (with PHP).

So what does a Flex-based RIA look like? Check these sites for example:

Yahoo! Maps

Harley Davidson Motorcycles