The OData Producer Library for PHP is now avilable for download. The OData Producer Library for PHP is a server library that allows to exposes data sources by using the OData Protocol.
PHP developers can now add OData support to their applications so it can be consumed by all clients and libraries that support OData.
“The library is designed to be used with a wide range of data sources (from databases such as SQL Server and MySQL to data structures that are at the application level for applications such as CMS systems),” revealed Interoperability @ Microsoft.
“Open Data Protocol is an open protocol for sharing data. It is built upon AtomPub (RFC 5023) and JSON. OData is a REST (Representational State Transfer) protocol, therefore a simple web browser can view the data exposed through an OData service.
The basic idea behind OData is to use a well-known data format (Atom feed or JSON) to expose a list of entities.”
“In order to make the library generic so it can be used on a wide range of scenarios we didn’t take any dependency to specific data structures or data sources. Instead the library is based on 3 main interfaces that, when implemented by the developers for the specific data source, allow the library to retrieve the appropriate data and serialize it for the client. The library takes care of handling metadata, query processing and serialization/deserialization of the data streams,” explains Interoperability @ Microsoft.
The OData Producer supports all Read-Only operations specified in the Protocol version 2.0:
- It provides two formats for representing resources, the XML-based Atom format and the JSON format.
- Servers expose a metadata document that describes the structure of the service and its resources.
- Clients can retrieve a feed, Entry or service document by issuing an HTTP GET request against its URI.
- Servers support retrieval of individual properties within Entries.
- It supports pagination, query validation and system query options like $format, $top, $linecount, $filter, $select, $expand, $orderby, $skip.
- User can access the binary stream data (i.e. allows an OData server to give access to media content such as photos or documents in addition to all the structured data)
“Two examples are included that show how a full OData service can be built using the library: the Northwind DB example uses an SQL Express DB as data source and the WordPress example that uses the WordPress’s MySQL DB Schema to expose a feed for Posts, Comments and Users.”
The library is available for download under the open source BSD license over at CodePlex.