Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PHP AMF3 extension

License

NotificationsYou must be signed in to change notification settings

neoxic/php-amf3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-AMF3 extension provides the following API:

amf3_encode(mixed $value [, int $opts = 0 ])

Returns a binary string containing an AMF3 representation of$value. On error, returnsFALSEand 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,        ];    }}

amf3_decode(string $data [, int &$pos [, int $opts = 0 ]])

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;

Installation

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

Usage constraints

  • PHPNULL,boolean,integer,float (double),string,array, andobject values arefully convertible to/from their corresponding AMF3 types;
  • AMF3Date 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 PHParray 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

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp