- Notifications
You must be signed in to change notification settings - Fork22
neoxic/php-amf3
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
PHP-AMF3 extension provides the following API:
Returns a binary string containing an AMF3 representation of$value
. On error, returnsFALSE
and issues a warning message. The$opts
argument is a bitmask of the following bit constants:
AMF3_FORCE_OBJECT
: force encoding non-indexed arrays as anonymous objects;
Objects implementingAMF3Serializable
interface can customize their AMF3 representation:
class MyClassimplements AMF3Serializable { ...publicfunction__toAMF3() {return ['foo' =>$this->getFoo(),'bar' =>$this->bar, ]; }}
Returns the value encoded in$data
. Optional$pos
marks where to start reading in$data
(default is 0). Upon return, it contains the index of the first unread byte (-1 indicates an error).The$opts
argument is a bitmask of the following bit constants:
AMF3_CLASS_MAP
: enable class mapping mode (see the usage constrains below);AMF3_CLASS_AUTOLOAD
: enable the PHP class autoloading mechanism in class mapping mode;AMF3_CLASS_CONSTRUCT
: call the default constructor for every new object in class mapping mode;
To install the extension, type the following in the source directory:
phpize./configuremakemake install
This should install the extension in your default PHP extension directory. If it doesn't work asexpected, manually put the targetamf3.so
library where theextension_dir
variable in yourphp.ini
points to. Add the following line to the corresponding section in yourphp.ini
:
extension=amf3.so
To run tests, type:
make test
- PHP
NULL
,boolean
,integer
,float
(double),string
,array
, andobject
values arefully convertible to/from their corresponding AMF3 types; - AMF3
Date
becomes a float value whereasXML
,XMLDocument
, andByteArray
become strings; - In a special case, PHP integers are converted to AMF3 doubles according to the specification.
- A PHP
array
is encoded as an indexed array when it has purely integer keys that start from zeroand have no gaps. An empty array adheres to this rule. In all other cases, an array is encoded asas associative array to avoid ambiguity. - When class mapping is disabled (the default), AMF3 objects are returned as associative PHP arrays.Otherwise, they are returned as PHP objects.
About
PHP AMF3 extension
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.