From AMFPHP to ZendAMF in 3 simple steps

The easiest and most effective way of communicating Flex application with PHP server was using the AMF protocol and AMFPHP libraries. Some people (including me) got accustomed to them, so the presentation of the new tool – ZendAMF – which is going to (in some way) replace AMFPHP, was not a very good news – AMFPHP was doing its job perfectly well, so learning new tool seemed to be waste of time.

Personally I believe, that new project should never use obsolete technologies, even if they work perfectly in current projects. So I decided to learn how to use ZendAMF, what is fortunately really easy.

Most of web tutorials about ZendAMF are for beginners in using PHP and Flex communication via AMF, so I decided to write a simple tutorial for people who are familiar with AMFPHP. Everything can be done in three simple steps:

Step 1

Install Zend Framework – download it, decompress it and make readable by web server (using chmod, chown, chgrp or whatever you want).

Step 2

Choose a directory accessible via web server. Place your AMFPHP class (lets call it legacyclass.php) there and create new file – let’s call it zendamf.php:



$server = new Zend_Amf_Server();
$server->setClass("legacyclass"); // place your class name here
echo ($server->handle());

Step 3
Change address for NetConnection in your Flex application, from AMF gateway, to zendamf.php address:

nc = new NetConnection();


That’s it. Pretty simple, uh?

  1. #1 by Buy Shilajit at November 3rd, 2018

    You provide awesome information. Most people don’t know but you have clear it.

(will not be published)
  1. No trackbacks yet.