Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Zend Framework Blog:
Implement JSON-RPC with zend-json-server
Jan 11, 2017 @ 18:47:01

On the Zend Framework blog there's a new post showing you how to implement a JSON-RPC interface with zend-json-server, a package from the Zend Framework 2 set of components.

zend-json-server provides a JSON-RPC implementation. JSON-RPC is similar to XML-RPC or SOAP in that it implements a Remote Procedure Call server at a single URI using a predictable calling semantic. Like each of these other protocols, it provides the ability to introspect the server in order to determine what calls are available, what arguments each call expects, and the expected return value(s); JSON-RPC implements this via a Service Mapping Description (SMD), which is usually available via an HTTP GET request to the server.

The article provides a basic example of the creation of a service that handles GET requests and gives back a service mapping description. Building on this, they show how to integrate it into an application that makes use of the zend-mvc structure. They implement a "JsonRpcController" using the same methods as before. Finally they show an example of performing JSON-RPC handling in middleware, outputting the same output as before based on the data in the $response variable.

tagged: zendframework jsonrpc zendjsonserver example controller middleware tutorial

Link: https://framework.zend.com/blog/2017-01-10-zend-json-server.html


Trending Topics: