19
1 2006 Adobe Systems Incorporated. All Rights Reserved. Flex & PHP for Rich Internet Application Development Charles Bihis Software Engineer [email protected]

Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

Embed Size (px)

DESCRIPTION

Discover how to easily integrate between your rich client interface and your server. My presentation revolves around integrating a Flex front-end with a PHP-driven back-end. http://work.whoischarles.com/content/flex-php-101-flex-php-for-rich-internet-application-development-slide-deck-and-sample-code

Citation preview

Page 1: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

12006 Adobe Systems Incorporated. All Rights Reserved.

Flex & PHP for Rich Internet Application DevelopmentCharles Bihis

Software Engineer

[email protected]

Page 2: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.2

Welcome!

Thanks for coming

What is a RIA?

Flex + PHP?

What can I build with it?

How can I build with it?

Demo REST

JSON

AMF

Q & A

+

Page 3: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.3

What is a RIA?

Rich Internet Applications Fully featured software package that runs in a browser

Look and feel of desktop applications

More than just Ajax on a website

Transfer the processing necessary for the user interface to the client

eg. Don’t go back to the server for filtering or sorting of data

We need TWO things…

• A powerful HOST• A rich CLIENT

We need TWO things…

• A powerful HOST• A rich CLIENT

Page 4: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

42006 Adobe Systems Incorporated. All Rights Reserved.

and

Flex Client-side technology

Object orientedActionScript 3.0

Flex applications are compiledCompile locally to SWF files for the Flash

Player Runtime

Flex Builder includes debugger

FREE!Flex SDK is free to download at Adobe Labs

PHP Server-side technology

Object orientedPHP 5

PHP is compiledCompile to bytecode for processing by

the Zend Engine

Dreamweaver does NOT include debugger

FREE!Released under PHP License and

considered free by the Free Software Foundation

Page 5: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

52006 Adobe Systems Incorporated. All Rights Reserved.

Flex + PHP

Full end-to-end solution

Serve

r

(PHP)

Client

(Flex)

Rich client interface handled by Flex

Powerful server-side data management handled by PHP

Easy integration between the two

Page 6: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.6

PHP-Powered RIAs

• mapping application

• http://maps.yahoo.com

• photo-editing application

• http://seespotslide.com

• live chat application

• http://www.activalive.com

• audio-editing application

• http://finetune.com

Page 7: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.7

“Rich Interactive Applications (RIA*) are at the centre of the drive to make the experience of a user’s interaction with software applications matter more.”

Ovum

What’s in it for you?

“By 2010, at least 60 percent of new application development projects will include RIA technology.”

Gartner

$5.5 Billion

Page 8: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.8

What’s in it for you?

QuickTime™ and aTIFF (Uncompressed) decompressor

are needed to see this picture.

QuickTime™ and aTIFF (Uncompressed) decompressor

are needed to see this picture.

* PHP jobs are 30x more abundant than Flex jobs

24 000 jobs

800 000 jobs

Page 9: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

92006 Adobe Systems Incorporated. All Rights Reserved.

Demo

Page 10: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.10

Demo

Getting started

Simple HTML Table Without sorting

With sorting

Flex + PHP using REST

Flex + PHP using JSON

Flex + PHP using AMF

Real-world example

Page 11: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.11

Getting Started

Have a LAMP installation up and running Windows: WAMP, http://www.wampserver.com/

Mac: MAMP, http://www.mamp.info

PHP >= 5.2 required for JSON library

Download Flex Builder: http://www.flex.org/download/

Create a MySQL database Name: MyDatabase

Table: Contacts

Columns: id, first_name, last_name, email

Download AMFPHP http://www.amfphp.org

Page 12: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.12

Recap

PHP to HTML Design-elements are coupled with the data

ALL processing is done on the server-side

Visually restricted by HTML style elements

PHP to Flex Data handled solely by the server, whereas design handled by client

Processing is distributed accordingly

Data processing handled by the server

Design processing handled by they client

Visually rich!

Page 13: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.13

Flex + PHP + Flickr = Simple Rich Flickr Photo Viewer

Accessing Flickr servers via PHP

Flickr returns data in serialized format

De-serialize in PHP

Output data in XML format, easily readable and accessible from Flex client

Page 14: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

142006 Adobe Systems Incorporated. All Rights Reserved.

One Step Further

Page 15: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.15

AIR + PHP + Flickr = Simple Rich Flickr Photo Viewer

Mostly the same code as in the Flex client Removed custom chrome

Re-added ability to move application window

Page 16: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.16

Q & A

Page 17: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.17

Tips for PHP Developers

Make sure your PHP is working before building your Flex application

REST (XML output) and JSON are really easy - Just call the PHP script in a browser

For AMF connections:

Service Capture is an useful tool, http://kevinlangdon.com/serviceCapture/

The Flex Debugger is your friend Read the help documentation and learn to use it

Page 18: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.18

Community Links

Get Started with Flex and PHP http://www.flex.org/php/

Frameworks: Drupal Services Module: http://groups.drupal.org/services/

Cake Framework: http://rdos.rd11.com/CakeAMFPHP/

AMF Implementations (all open source): The Midnight Coders

http://www.themidnightcoders.com

AMFPHP

http://www.amfphp.org/

Page 19: Flex & PHP 101 - Flex & PHP for Rich Internet Application Development

2006 Adobe Systems Incorporated. All Rights Reserved.19