This module adds a server based on the AMF protocol to the Services module for Drupal 7.
It allows for communication between an actionscript 3 client - like flash, flex and air - with drupal core services or custom services via amf, also known as flash remoting.

This module uses Zend AMF classes from the Zend framework to provide support for services defined in the service api.

This module is to D7 as the amfphp module was to D6, but with one big advantage: it doesn't use the outdated and badly maintained php4 amfphp framework but the Zend AMF php5 implementation. you can read about it by the former lead developer of amfphp, who is now lead developer for zendamf:.


  • It makes use of Zend AMF as core AMF engine (not included, but can be downloaded from and preferrably installed in sites/all/libraries. The Zend framework can be used in other modules of your drupal site.
  • The AMF0 protocol and AMF3 protocol are supported.
  • One or more endpoints can be made available for the server (basically a gateway/url to connect to to access the services)
  • Each endpoint can have it's own resources attached to it. A resource is a remote method in it's own service namespace eg: "node.retrieve"
  • An endpoint can be tested by visiting it in your url, it will display some information about the endpoint and this will let you know it's functioning.
  • Session authentication via the new services 7.x-3.x architecture is implemented. this means you can log in from the actionscript client. It is also implemented for standalone clients (flash player, flash and flex authoring tool, air apps, compilation via fdt etc) which means you can also log in without using cookies that drupal uses for sessions. In that case, the authentication is handled via low level amf headers, which you either set yourself or use 3rd party libraries that handle that for you.
  • Permissions are needed to get access to the resources, which will be set per role via the drupal permission system. Via session authentication it is possible to login to the drupal system.
  • Rather than being defined in classes, services resources are defined in Drupal modules which can use classes. Custom resources can be defined, for more information see the services api and the documented code of the module itself.
  • Classmapping is functional and can be configured for your own specific classmapping needs
  • From a flash client point of view, all communication is done in the normal way of doing flash remoting. Some drupal specific actionscript code is needed for authentication issues and data manipulation, this is an issue that will be true for any implementation and this was also the case for the D6 amfphp module. Luckily, this is abstracted away by existing third party actionscript libraries.
  • Demo actionscript code is available in the module. It features a test suite and example code plus the actionscript classes that abstract away the low level details. (demo package: org.drupal.amfserver)
  • Good error handling: sensible and translatable error messages from the amfserver in case of misconfiguration etcetera. Arguments checking is handled by the server.
  • A Demo service included with some methods for testing the amfserver. the code in the module can be the basis for your own service implementations.
  • Useful help text for the amfserver is located in all the relevant places.
  • Testing with the simpletest framework ("Testing" module in D7 core) with the help of an AMF PHP client by SabreAMF


  • Services 7.x-3.x-rc2 version or later has to be installed to provide the services for the amfserver to work.
  • The Zend Framework has an AMF implementation that is used by the amfserver.
  • Optional is an actionscript framework for communicating from a client written by the author of this module. The opensource dpdk package has a tested drupal package which functions with both D6 (amfphp) and D7 (amfserver). The drupal code is in the package

Installation and configuration

  • Make sure the services module (> 7.x-3.x-rc2) is installed, else install it first.
  • Get the amfserver module and place the entire amfserver folder in either
    • preferred: sites/all/modules (sites/all/modules/amfserver)
    • sites/all/modules/services/servers (sites/all/modules/services/servers/amfserver)
  • Download the Zend Framework and place the zend library in the drupal folder 'sites/all/libraries' with the name 'Zend' (sites/all/libraries/Zend).
    If the sites/all/libraries directory is not present, create it first.
    The main thing is that the AMF code is included. All other functionality in the Zend framework is a bonus.
  • Enable the amfserver module in the modules section.
  • Create the service endpoint for the amfserver via the services module.
  • Configure the resources on the service endpoint. This let's you access the resources via the amfserver. A resource is a service/method combination.
  • Set permissions, if necessary, for the resources you want to use. for example, if you want to access node data, set the node permission 'View published content'.
  • Visit the endpoint by going to the url []/[path_to_endpoint] (replace what's inside the brackets to your needs) to see that it's functioning. You will get a message informing you of what's going on.
  • optional: Create your own custom service module to let your services that talk with flash do whatever you want.
  • optional:) In case you wrote your own custom service module, you can also configure classmapping via the amfserver settings, to map your own php classes to actionscript classes and vice versa.
  • Create your actionscript client. We recommend the opensource drupal library by the author of the amfserver module which you can download at, both for drupal 6 and drupal 7 flash integration. Contained within the module is testing code written for this module that makes use of that library. The drupal code is located in the package.
  • optional: In case you are connecting to the amfserver from a different domain or subdomain, you should use a crossdomain.xml file of which an example is included in the module.


  • Integration with drush with auto download of Zend libraries
  • Authenticaion is on the agenda, this will also depend on the development of the services module and the oauth module.
  • Configuration of the amfserver if/when needed.
  • A demo module for your own services implementations. as of now, there is demo code included in the module itself, just not as a standalone module.
  • A service browser, although this should be implemented in services itself. We'll see what services will bring...
  • Upgrade/refactoring where needed for the D7 actionscript libraries, to maintain compatibility with both D6 amfphp and D7 amfserver. This is a continuous work and upgrades in one might mean upgrades in the other.


  • module inspiration by Jeff Gauthier/ obstacle: it started here
  • work on the module started after the premiere of the new foo fighters' movie 'back and forth' with the simultaneous release of their new album 'wasting light'. Rock on!




7.x-3.03tar.gz (760.15 KB) | zip (764.33 KB)2011年10月25日发布说明简 | 繁 | 更多