Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Amf Component Proposal

Proposed Component Name Zend_Amf
Developer Notes
Proposers Wade Arnold
Zend Liaison Stanislav Malyshev
Revision 1.0 - 1 January 2008: Initial Draft. (wiki revision: 23)

Table of Contents

1. Overview

Zend_Amf_Server provides Action Message Format (AMF3) support for the Zend Framework that is compatible with the Flash Player 9 and above. The Adobe Integrated Runtime (AIR) and Flash Player uses AMF to communicate between an application and a remote server. AMF encodes remote procedure calls (RPC) into a compact binary representation that can be transferred over HTTP/HTTPS protocol. Objects and data values are serialized into this binary format, which increases performance as the AMF serialization is a highly optimized procedure in the Flash Player. Zend_Amf_Server will act as an AMF gateway to the Zend Framework by exposing through introspection custom class objects and functions that will respond as callbacks through the Zend_Amf_Server gateway.

What is AMF?
Action Message Format(AMF) is a binary file format representing a serialized ActionScript object. The AMF file type is used throughout the Flash Player for data storage and data exchange. For example in the Flash Player AMF is used in SharedObjects, RemoteObjects, LocalConnection, ByteArray, RTMP, and all RPC operations. Some of the benefits of AMF include:

  • File Size - AMF objects are very small and are compressed using zlib.
  • Fast Serialization/ Deserialization - AMF is transformed using native C code in the Flash Player making it very fast. The AMF format was designed to serialize and deserialize quickly under low memory and slower CPU conditions making it perfect for the web. AMF data is parsed directly into objects, meaning there is no lag for interpretation or parsing of AMF making the creation of objects complete in a single pass.
  • Native Types and Custom classes supported - You can serialize any object in Flash Player with the only exception being a can also map serialized objects back to custom class instanced provided the custom class is in the Flash Player when the AMF object is deserialized.
    AMF existed in ActionScript 2 and was just called AMF as of ActionScript 3 the AMF protocol has been updated and is referred to as AMF3. For historical reasons the original AMF format is now referred to as AMF0. One of the main upgrades to AMF3 is that the object is now zlib compressed for faster transfer do to the smaller file size and the additional of data types that were released with actionscript 3.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

**PHP5 Reflection extension
*Zend Framework
**Zend_Amf_Value family of classes
**Zend class

4. Dependencies on Other Framework Components

  • Zend_Server_Interface
  • Zend_Server_Reflection
  • Zend_Server_Reflection_Function_abstract
  • Zend_Server_Reflection_Method

5. Theory of Operation

Zend_Amf_Server is composed of several components, ranging from the server itself to request, response, encoding, decoding, and fault objects.

To implement Zend_Amf_Server, the developer must attach one or more classes or functions to the server instantiation, via the setClass() and addFunction() methods.

The Zend_Amf_Server will decode request objects that are received via php://input and deserialized the request and check for an existing instantiated session. Zend_Amf_Request will check the AMF header for the matching name space of the requested remote object to be called. The remote object will be instantiated and the result of the method call will be serialized via Zend_Amf_Vaslue and returned to the requested http connection via Zend_Amf_Response.

ActionScript PHP
undefined null
null null
int integer
number float
boolean boolean
String string
Array array
Object Associative array
xml DomDocument
Date Date
RemoteClass class mapped object
uint ?
ByteArray Zend_Amf_Value_AMF3_ByteArray

6. Milestones / Tasks

7. Class Index

  • Zend_Amf_Fault
  • Zend_Amf_Request
  • Zend_Amf_Request_Http
  • Zend_Amf_Response
  • Zend_Amf_Server
  • Zend_Amf_Server_Exception
  • Zend_Amf_Server_Fault
  • Zend_Amf_Util_BinaryStream
  • Zend_Amf_Value
  • Zend_Amf_Value_Number
  • Zend_Amf_Value_Boolean
  • Zend_Amf_Value_String
  • Zend_Amf_Value_Object
  • Zend_Amf_Value_Null
  • Zend_Amf_Value_Undefined
  • Zend_Amf_Value_Refrence
  • Zend_Amf_Value_MixedArray
  • Zend_Amf_Value_Array
  • Zend_Amf_Value_Date
  • Zend_Amf_Value_Xml
  • Zend_Amf_Value_TypedObject
  • Zend_Amf_Value_Amf3_Intiger
  • Zend_Amf_Value_Amf3_Date
  • Zend_Amf_Value_Amf3_String
  • Zend_Amf_Value_Amf3_Xml
  • Zend_Amf_Value_Amf3_ByteArray
  • Zend_Amf_Value_Amf3_Array
  • Zend_Amf_Value_Amf3_Object

8. Use Cases

9. Class Skeletons


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.