Posts filed under 'Flex,AMF,PHP'

AMFPHP Deserializer and POG classes

The default AMFPHP patterns for including classes defined in your AMF requests do not work for POG classes. The two default patterns that are check for class including by the AMF deserializer are:

PHP:
  1. // $mappedClass = SomeObject
  2. $mappedClass . "php" // SomeObject.php
  3. // or
  4. $mappedClass . ".class.php" //SomeObject.class.php

For POG classes the pattern is "class.someobject.php", regardless of the case of the SomeObject class.

Now to added different locations for AMFPHP to look for classes to include for deserialization of AMF requests you open up /amfphp/core/amf/io/AMFBaseDeserializer.php. Go to line 384 (as of AMFPHP 1.9 or the block of code starting with file_exists($GLOBALS['amfphp']['customMappingsPath']) and add the following code for POG classes pattern:

PHP:
  1. elseif(file_exists($GLOBALS['amfphp']['customMappingsPath'] . 'class.' . strtolower($mappedClass) . '.php'))
  2. {
  3.     $include = $GLOBALS['amfphp']['customMappingsPath'] . 'class.' . strtolower($mappedClass) . '.php';
  4. }

Now your AMF request classes passed in method parameters will be deserialized on the PHP to the correct POG class.

3 comments March 21st, 2008


A Zend Framework Powered Flex Picture Book (ZendCon 2007 session)

Ok that was a long title. But I just got done with presenting at ZendCon 2007 in San Francisco and feel like a long title. The session was geared to take Cal Evan's, "Flex and PHP: Party in the Front, Business in the Back", a do some Flex enhancements on the Front end side.

What came out of the session was a Flex RSS Picture Book. Using Ely Greenfield's FlexBook component, the picture book displays images from the keyword's of the articles description text.

Here is the live example of the Flex RSS Picture Book, remember to click on the image to see the Article's title and description.

You can find the Flex RSS Picture Book source here, this source includes just the MXML and a slightly modified FlexBook source to handle crossdomain security. You'll need to get the PHP source from Cal Evan's original article.

1 comment October 9th, 2007

MAX 2007 Session Source Files

You'll find the PDF's of the session on Flex and PHP on the MAX website. I think its available to people who attended MAX and later it will be available to everyone. The didn't seem to put up the actual source code that went along with the session. The session was gear for someone with no Flex experience, but the people attending MAX and the session had plenty of Flex experience.

Between trying to change up the session for the higher skill level, the machines having issues, and the internet not working on the time what I presented at MAX differs slightly from the material here. You can find a excerpt from the PDF handout here to get your going on the PHP side of the session. You'll find on the last page of the PDF instructions of how to setup Apache PHP and mySQL on a Windows XP box as well as how to setup the Flex Builder 3, PHPEclipse plugin and the Zend Framework.

Either way you can find plenty of information on Flex and PHP examples on my blog. Here are two links to some source files:
MAX 2007 Flex and PHP source material
360Flex Flex and PHP examples

Add comment October 6th, 2007

My MAX Speaking Sessions

This year at MAX I will be presenting one of the hands on sessions. It is titled:
RA101H: Hands On: Building a Rich Internet Application with Flex 3 and PHP.

It is geared for people with no Flex experience and will be pretty basic overview of Flex 3 and connecting to PHP through HTTPService. The fun part is I will be giving the session 4 times over the course of the 3 days. If you are going to MAX feel free to come by join a session or say hi.

6 comments September 26th, 2007

Speaking at ZendCon on Flex and PHP

I will speaking at the 2007 Zend/PHP Conference and Expo, http://zendcon.com. The title of the session is, "Build a Sexy Front End to a Zend Framework Powered Application". I will be using a previous Flex/PHP example created by Cal Evans.

If you are going to ZendCon this year come by and say hi on Tuesday. My session is at 11:15am.

Add comment September 10th, 2007

Flexing PHP in php|architect, by Jeof Oyster

Its cool to see the Flex developer base grow more and more everyday. I came across a Flex and PHP article in the lastest php|architect magazine. The article is titled "Flexing PHP" and is by Jeof Oyster. If you read Jeof Oyster's bio, he is a product manager for a financial services company and freelancer by night. This is a cool sign of the breadth of Flex developers and the rise in outside Adobe/Macromedia circles expose Flex is getting.

The article is a good overview of the Flex builder and SDK and now to create a Flex application along with accessing data through HTTPService and PHP. Check it out at http://www.phparch.com (June 2007 issue).

3 comments June 21st, 2007

RemoteObjectAMF0 Update

The RemoteObjectAMF0 under went a few updates.

  • Updated code with better comments for ASDoc's and readability
  • Added SetCredentials
  • Added Fault handler for NetStatus errors
  • Added 1st round implementation for "method" definitions.
    • Allowing you to define result/fault event handlers per method.
    • This is done with a <renaun:methods/> tag and a <renaun:method/> component.

Example of using the <renaun:methods/> tag:

XML:
  1. <renaun:RemoteObjectAMF0
  2.         id="contactsService"
  3.         source="ContactsService"
  4.         endpoint="http://localhost/amfphp1_9/gateway.php"
  5.         fault="Alert.show( event.message.toString() )">
  6.         <renaun:methods>
  7.             <renaun:method
  8.                 name="GetContacts"
  9.                 result="changeContactList( event )"
  10.                 makeObjectsBindable="true" />
  11.                        
  12.             <renaun:method
  13.                 name="MaintainContact"
  14.                 result="Alert.show( event.result.toString() )"
  15.                 makeObjectsBindable="true" />   
  16.                
  17.         </renaun:methods>               
  18.     </renaun:RemoteObjectAMF0>

You can find the full source to this example in the 360Flex presentation source located at:
http://renaun.com/360Flex/

The updated RemoteObjectAMF0 code can be found at - http://renaun.com/flex2/RemoteObjectAMF0/renaun_com_RemoteObjectAMF0.zip

NOTE: The zip download now includes a swc compiled for Flex 3 which was giving a warning about a override method error.

2 comments March 12th, 2007

360Flex “Flex with PHP” Presentation

Currently the 360Flex conference is on it's second day. More than half over. I had the fun opportunity to be called out of a session to find out that my presentation has been changed from today til tomorrow (Ben Forta flys out tomorrow and needed to switch). The switch doesn't bother just glad to help. So for those that are wondering it is changed to tomorrow at 2:30pm.

I have prepared and some example code based on Tom Ortega's 360Flex Contact Manager. It takes the Flex application Tom created in Flex 101 and puts a PHP backend on it. The examples I will be walking through is not just one way but 4 different methods of talking to Flex with PHP. I will show how to communicate with Flex through XML (Simple), FlashVars, SOAP (Nusoap), and AMF (AMF0 and AMF3).

In the process I have updated the RemoteObjectAMF0 component I created many a month ago.

Some time when I get back from the conference I'll talk about the specific updates I made to RemoteObjectAMF0. Those attending the conference will get the sneak peek.

3 comments March 6th, 2007

All in One - Cairngorm Store Example (ColdFusion, AMFPHP, AMFPHP 1.9, and WebServices)

I have updated the Cairngorm Store multiple backend example. Along with the updated source code I have deploy a live running example. The 4 backends it supports now is ColdFusion Remoting AMF3, AMFPHP AMF0 using the RemoteObjectAMF0 class, AMFPHP 1.9 AMF3, and ColdFusion WebServices.

See it live here!

Get the source here!

To change the backend of the Cairngorm Store example just select the backend you want from ComboBox and then click on the Refresh Data button. I had to do write some exception code to convert the returned XML data into the ArrayCollection to conform all the backend but besides that it was really easy to integrate all of them into the Services.mxml.

PS: I just installed a new license on the ColdFusion server with a new Apache web server configuration so let me know if there are any issues.

26 comments December 19th, 2006

Flex 2 RemoteObject with AMFPHP supporting AMF3

Patrick Mineault has created an alpha update of AMFPHP that now supports AMF3. He is looking for people to test it out. To help with this I have created two simple examples that I have running live on a PHP4/Apache server, as well as have tested on a PHP5/Windows box.

Basic Example
Return Array of VO's Example

You can download the source for both examples by right clicking on the apps or get it here.

Note: To make the amfphp 1.9 alpha code to work with PHP4 there you need to implement a different function for the array_search() when the search needle is a object.

14 comments December 12th, 2006

Previous Posts


Disclaimer: I work as a Flash/Flex Developer for Adobe Systems Incorporated. The opinions expressed here represent my own and not those of my employer.

My Amazon.com Wish List

Calendar

July 2008
S M T W T F S
« Jun    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Posts by Month

Posts by Category


Flex.org - The Directory for Flex