sfAmfPlugin - 0.9.3

This Plugin to handle AMF requests from Flex client frontends

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfAmfPlugin

Overview

The sfAmfPlugin provides you with all you need to write symfony backends for Flex clients. The communication is done via Adobes AMF protocol. On serverside the SabreAMF library is used to encode/decode the AMF streams.

Install

Please use the current version from the subversion repository (http://svn.symfony-project.com/plugins/sfAmfPlugin). Copy the checked out version to the plugins folder of your project and execute the command symfony cc.

That's it

Usage

AMF-Client Requests are try to execute Services on the backend. Therefore you have to create a RemoteObject in Flex that has a Symfony-URL (i.e http://flextest/Test/amf).

All your services you can call will need to be saved under lib/services in your project folder. There you can add as many subfolders as you need/want. Services on Flex-Side can use package names like org.company.project.Servicename. You can use this with symfony too. All you need to do is to save this Service under lib/services/org/company/project/Servicename.php. That’s it!

A service can look like this:

class TestService extends sfAmfService {
    public function getValues() {
        return array('value1', 'value2', 'value3');
    }
}

Please keep in mind that your service needs to extend th sfAmfService class

But how is this service called from client side? We need an URL to do so. For symfony this means you need a module and an action. The following listing shows you how an AMF action should look like:

public function executeAmf() {
    $this->setLayout(false);

    $gateway = new sfAmfGateway();
    $response = sfContext::GetInstance()->getResponse();
    $response->setContent($gateway->service());
    return sfView::NONE;
}

Future improvements

  • Support for Doctrine objects (done in version 0.9.2)
  • Support for Propel objects (done in version 0.9.3)
  • PEAR packaging so that you can install via the symfony installer(done in version 0.9.2)
  • Annotations for the Service-Methods (i.e. authorization, Class binding and so on)
  • Configurable services folder

License

For the full copyright and license information, please view the LICENSE file that was distributed with this source code.