Skip to content

JohnField/osrf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openSRF

PHP client for openSRF, a message passing architecture used by the Evergreen Integrated Library System (ILS) and supported by Equinox Software.

About OpenSRF

OpenSRF is a protocol intended for low-level business logic, passed between Evergreen components. For higher-abstraction operations such as information retrieval, Evergreen's support of OpenSearch and unAPI are recommended instead.

This client aims to hide some implementation details, however developers are encouraged to be familiar with the internals of OpenSRF:

Requirements

PHP 5.4 and up. For specific supported versions, see .travis.yml. For dependencies, see composer.json.

Installation

This client uses Composer (with namespaces and PSR-4 autoloading). It isn't on Packagist yet.

Usage

The client takes services, methods and data (also as parameter) to make requests and receive responses from OpenSRF services, and return a simple parsed output. Setting up an OpenSRF session will retrieve the fm_IDL.xml file from the targeted server, which provides that server's Interface Description Language. This essentially means class definitions that allow certain data structures to be interpreted as objects in the Object-oriented sense. Examples of some typical usage are under the examples/ directory.

Internals Overview

  • OrsfSession represents a session with a specific Evergreen server.
  • On initialisation, it collaborates with OsrfFieldmapper to get the Interface Description Language from the server (the fm_IDL.xml file) and write field mappings in a temporary file.
  • This is then used to interpret requests and responses for that specific server.
  • Making an OpenSRF request involves calling osrfSession::request(), with suitable parameters; this is usually a combination of method, service, endpoint and other paramaters and will vary depending on the exact call.
  • This creates an instance of osrfMessage, which constructs and sends both the message and the JSON payload via osrfMessage::send().
  • Internally, osrfMessage::setGuid() and osrfMessage::header() supports stateful sessions.
  • The raw JSON response is held, unsurprisingly, in an instance of osrfResponse, where it is also parsed to be more useful.
  • User authentication requests are supported via osrfSession::login(); when working with multiple users, please use multiple osrfSession instances (though at time of writing the authtoken is not used).

For more information about specific functionality, see the documentation in each class.

Troubleshooting

Testing

There are test servers freely available, which can be used to test the code. Test servers can be found at http://open-ils.org/dokuwiki/doku.php?id=community_servers

If you still have any questions or doubts, you are free to talk to Evergreen, an open source Integrated Library System (ILS) ( IRC: #evergreen channel on the Freenode server HomePage: http://evergreen-ils.org/ )

Packages

No packages published

Languages

  • PHP 100.0%