tecbot / AMFBundle

AMF for Symfony2
21 stars 11 forks source link

======== Overview

This bundle allows you to use AMF with the Symfony2 Framework. Main features include:

Installation

Checkout a copy of the code::

git submodule add https://github.com/tecbot/AMFBundle.git src/Tecbot/AMFBundle

Then register the bundle with your kernel:

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new JMS\AMFBundle\TecbotAMFBundle(),
    // ...
);

Make sure that you also register the namespaces with the autoloader:

// app/autoload.php
$loader->registerNamespaces(array(
    // ...
    'Tecbot'              => __DIR__.'/../vendor/bundles',
    // ...
));

Note: The serializer needs the JMSSerializerBundle.

Configuration

Below is the default configuration, you don't need to change it unless it doesn't suit your needs:

tecbot_amf:
    use_serialization: false

Usage

Configuring services and class mappings

tecbot_amf:
    services: # Services
        FooService: FooBarBundle:Foo # Map FooService (Actionscript alias) to Foo\BarBundle\Amf\Foo class
    mapping: # Class mapping. Map FooClassVO (Actionscript alias) to Foo\BarBundle\VO\FooClassVO
        FooClassVO: Foo\BarBundle\VO\FooClassVO

Add routing to the gateway controller

# path is "/gateway"
_tecbot_amf:
    resource: "@TecbotAMFBundle/Resources/config/routing.yml"

# or when you want a another path
amf:
    pattern: /amf
    defaults: { _controller: tecbot_amf.controller.gateway:gatewayAction }

Example App

See AMFBundle-sandbox