Monthly Archives: November 2008

SWORD PHP library

As part of the JISC funded SWORD2 project, I have now written a PHP library for SWORD which is now available for download from:

There are many web applications that could deposit into repositories using SWORD, and many of these are written in PHP. Examples might include open source Content Management Systems, Blogs or Wikis. By using this library you can easily retrieve service documents and make deposits by using the API provided. There are two simple method calls (one to retrieve a service document and one to deposit a file). In addition there is a packager included that can package a file and metadata together into a package format supported by both DSpace and EPrints. This is the same code which is used to power the Facebook SWORD deposit tool (

The code is currently an early release – version 0.4. It has now been tested again DSpace, EPrints, Fedora and Intralibrary. This means that the Facebook application will now successfully deposit to all four of these (previously there was an issue with EPrints as it returned its atom documents using the default atom namespace and the PHP library didn’t cope with default namespaces. The library has now been fixed to cope with that). However there are likely to be issues discovered as it is used more, so please feel free to try out the code and get in touch if you find any issues.

The code will shortly be upgraded to support the new SWORD version 1.3 specification.

The library requires PHP5, built with SimpleXML (to parse the XML responses from the repositories) and CURL (for the HTTP functions).