Introduction to Flex Using PHP


With all the hype (and money) surrounding buzzword terms like Web 2.0 and Rich Internet Applications (RIA), it’s easy to wonder, “How can I integrate that into my PHP application?” Certainly, Asynchronous JavaScript and XML (Ajax) technologies that use JavaScript code are a good option. But you should also have a look at the Adobe Flex framework. With Flex, you can quickly build functional, attractive user interfaces in Adobe Flash that communicate to your PHP web application through XML.

Let’s step back and look at what Flex is and how it compares to standard HTML development with a language like PHP. Both the traditional Web 1.0 HTML architecture and the Flex-based architecture are shown in following Figure.

The Flex architecture compared to the standard PHP web page architecture
Figure 1. The Flex architecture compared to the standard PHP web page architecture

On the left, you can see the standard PHP workflow you’ve come to know. The browser makes a request of the PHP web page, which talks to the database and sends back HTML to satisfy the customer’s request.

On the right is the Flex approach. The customer navigates to the page, where a Flex application (a SWF file) is loaded that contains the user interface for the form. This Flex application then uses XML to read or write data to the PHP pages on the server. Those new PHP pages talk to the database and return XML to the Flex application for display. The dashed lines on the list.html and list.swf files indicate that they were generated by Adobe Flex Builder 2.

The advantage of Flex is that the framework provides an amazing set of interface tools that make it easy to build highly interactive user interfaces. In addition, there are many advantages to having the PHP pages return XML instead of (or in addition to) HTML. Here are just a few:

  • Desktop applications, such as Microsoft Office Excel, are starting to consume XML, making it easier for your customers to access their data.
  • Your customers can write or modify their own applications to use your XML instead of screen scraping your HTML pages.
  • If you choose a standard XML data format, such as RSS, specialized readers support the format.
  • You can use XSL to query or format the data from the server however you choose.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: