Amfphp Manual

Amfphp is an RPC toolkit for PHP. It allows seamless communication between PHP and:

  • Flash and Flex with Remoting
  • JavaScript and Ajax with JSON
  • XML clients with XML-RPC

What's RPC?

RPC (Remote Procedure Call) is a way to communicate data between a client and a server. You call a method on a local object with various parameters, set a callback, and receive a result. You don't have to worry about how you're going to send and receive the data. The implementation details are abstracted away so that it looks as though you're calling a local method.

How it works behind the scenes

The server and the client, say php and Flash, agree on a common way of describing method calls and complex data. The client serializes a request and sends it to a gateway. Amfphp then automatically:

  • Deserializes the request
  • Finds the corresponding remote class
  • Instantiates the class
  • Performs security checks
  • Calls the remote method using the specified arguments
  • Serializes the returned data

Amfphp can properly serialize and deserialize complex types. In addition to objects and arrays, it supports resources from database connections, which means you can simply return mysql_query from your remote method and amfphp will know what to do with it. If the platform supports it (currently, Flash Remoting only), it can handle circular references and typed objects. It also supports simple remote debugging. Finally, amfphp comes with a service browser which allows you to test your services before creating a frontend.

 

 

 

 

 

 


© amfphp.org | Disclaimer | Conditions of use