Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
doc Oh, HAI! No markdown extra? I canz fix.
src/LibRIS TY should be the first tag when writing records
tests Updated unit tests.
.gitignore Added a gitignore.
API-1.0.0 Revamped source to work with Pyrus.
API-1.1.0 Built new release
API-2.0.0 Updaed package info.
Makefile Updated Makefile and composer.
README Revamped source to work with Pyrus.
README.mdown Updated code sample.
RELEASE-1.0.0 Revamped source to work with Pyrus.
RELEASE-1.1.0 Built new release
RELEASE-2.0.0 Added a new RELEASE file.
RELEASE-2.0.1 Added release notes for (nonexistent) 2.0.1 release.
build.xml Revamped source to work with Pyrus.
package_compatible.xml Updated Makefile and composer.


LibRIS: An RIS parser for PHP

  • Author: Matt Butcher, 2010-02-06
  • License: An MIT-like license (COPYING-MIT.txt)

This library provides basic marshaling and unmarshaling support for the RIS format.

RIS is used to encode metadata about references. The normative reference for the format can be found here:


Method 1: Install using Packagist.

  1. Follow the instructions at
  2. In your new project, create a composer.json file which requires LibRIS:
  "require": {
    "technosophos/LibRIS": ">=1.0.0"

When you next run php composer.phar install it will automatically fetch and install LibRIS.

Note that as of LibRIS 2.0.0, the Composer autoloader can load LibRIS:

require 'vendor/.composer/autoload.php';

use \LibRIS\RISReader;

$reader = new RISReader();


Method 2: Install LibRIS using Pear

Use your pear client to install LibRIS:

pear channel-discover
pear install querypath/LibRIS

For more, see

Use it in your scripts like this:

require 'LibRIS.php';

If you have already installed LibRIS using Pear, you can upgrade your library to the latest stable release by doing pear upgrade LibRIS.

Method 3: Download LibRIS

  1. Get LibRIS from the downloads page
  2. Uncompress the files (tar -zxvf LibRIS-1.0.0.tgz)
  3. Put the files where you want them to go.

Use it in your scripts like this:

require 'path/to/LibRIS.php';

Using LibRIS

General usage for this class is simple:

  • The LibRIS class is used to parse RIS.
  • The RISWriter class is used for writing RIS data into a string.

Here's an example (from test/simple_test.php):

require_once 'LibRIS/RISReader.php';
require_once 'LibRIS/RISWriter.php';

$ris = new \LibRIS\RISReader();


$records = $ris->getRecords();

$rw = new \LibRIS\RISWriter();
print $rw->writeRecords($records);

Here's a line-by-line explanation of the code above:

1. Include the libraries.
2. You don't need this if you use an autoloader.
4. Create a new LibRIS reader
5. Parse a file
7. Pretty-print the parsed records
9. Create a new writer
10. Turn our parsed record back into a valid RIS record.

The format of the records is documented in doc/RecordFormat.mdown.

I Found a Bug!

If you found a bug, please let me know. The best way is to file a report at

You can also find me on Freenode's IRC in #querypath.

The Phing Script

This file includes a Phing build.xml script. However, it is rarely used.

If you are interested in using this as part of a build toolchain, see

Why is there a README file and a README.mdown file?

  • README is a required file for the Pear packaging system.
  • README.mdown is the GitHub-friendly README file for this project.
Something went wrong with that request. Please try again.