funstaff/ref-lib-ris

RIS is a format for reference metadata

2.0.1 2019-03-21 12:12 UTC

This package is auto-updated.

Last update: 2024-04-22 00:16:49 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version License SensioLabsInsight

This library provide a writer to RIS data format.

Installation

  1. Follow the instructions at http://packagist.org
  2. In your new project, create a composer.json file which requires RefLibRis:
{
  "require": {
    "funstaff/ref-lib-ris": ">=2.0"
  }
}

Use

<?php

namespace ...;

use Funstaff\RefLibRis\RecordProcessing;
use Funstaff\RefLibRis\RisDefinition;
use Funstaff\RefLibRis\RisMappings;
use Funstaff\RefLibRis\RisWriter;

$mapping = [
    'DEFAULT' => [
        'TY' => ['type'],
        'AU' => ['author'],
        'TI' => ['title', 'title_secondary'],
    ],
    'BOOK' => [
        'TY' => ['type'],
        'AU' => ['author'],
        'TI' => ['title', 'title_secondary'],
        'ID' => ['recordid']
    ]
];

$recordDb = [
    'title' => ['History of the CDC PY - 1999'],
    'author' => ['Behrens, J.', 'Behrens, A.'],
    'type' => ['BOOK']
];

$risMappings = new RisMappings($mapping, 'DEFAULT');
$recordProcessing = new RecordProcessing($risMappings);
$record = $recordProcessing->process($recordDb);

$writer = new RisWriter(new RisDefinition());
$output = $writer->addRecord($record)->process();

Output:

TY  - BOOK
AU  - Behrens, J.
AU  - Behrens, A.
TI  - History of the CDC PY - 1999
ER  -

Found a bug

If you found a bug, please let me know. The best way is to file a report at http://github.com/funstaff/RefLibRis/issues.