How to create Magento AMF server extension

I have been working on a project, in my own time, that involves Flex – Magento communication. I decided to test Adobe’s AMF format. In this article I will show you how easy is to create AMF server as an extension in Magento.

So, where to we start?

The idea is to have special Url which will act as AMF endpoint. Since Magento is built on top of Zend, this is extremely easy to do.

For your module to act as a basic AMF server you need only 3 files. MyCompany_MyModule.xml that goes under the /app/etc/modules/ folder. Then IndexController.php that goes under the /app/code/local/MyCompany/MyModule/controllers/IndexController.php. And last but not least the config.xml file that goes under the /app/code/local/MyCompany/MyModule/etc/ folder.

I will not go into the details and show you the full content of each of those files. Important thing is to focus on IndexController.php and config.xml files. Inside your IndexController.php file you will actualy hold the code for your AMF server (Zend_Amf).

Here is an example of indexAction from my IndexController.php file:

public function indexAction()
	//Create AMF server instance     
	$server = new Zend_Amf_Server();
	//setProduction(false): return exception info
	$server->setClass($class, $class);
	//$server->setClassMap("SomeTypedObjectVO", "MyCompany_MyModule_Model_SomeTypedObjectVO");
	$server->setClassMap($className, $class);
	//Run the AMF server
	echo $server->handle();
	//Just in case so that Magento does not pass anything beyond this point

The above example is the simplest form of Zend AMF server i can think of, but it should be enough to get your AMF server responsive to AMF requests.

And to make all of this accessible via Url, we need to add entry to congig.xml file. Below is the partial example of my config.xml file.


Above piece of code sets access to AMF server on Url like http://server/store/index.php/myamfserver.

Thats it.

You made it all the way down here so you must enjoyed this post! You may also like:

How Inchoo developed Morris 4x4 Center Jan 29, 2018

How we developed a new Morris 4×4 Center store – case study

/ Leave a comment
Jan 18, 2018

Magento 2 Product Quick View

/ Leave a comment
Oct 18, 2017

Solr and Magento – search by department

/ Leave a comment


  1. Hi Branko,

    I’ve been waiting so long for the release of the Matsiya AMF API for Magento without getting news.

    Have you ever planned about developing an open source AMF API for Magento? If yes, It would be great to participate 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.