PHP code example of funstaff / ref-lib-ris

1. Go to this page and download the library: Download funstaff/ref-lib-ris library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

funstaff / ref-lib-ris example snippets




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();