Description
This is an another effort to implement a standalone CSL processor in PHP. This program can be used to render bibliographies using CSL Stylesheets. This repository is a fork of the implementation of Sebastian Böttger which is a fork of the implementation of rjerome (apparently no longer maintained).
I renamed it to citeprocessor because of use it for personal purposes.
Some advantages:
- uses Composer
- each class is located in a separate file
- uses namespaces
- uses the autoloader of Composer
- uses PHPUnit for testing
- better integration
Use Composer to add citeprocessor to your app by editing your composer.json:
"repositories": [
{
"type": "vcs",
"url": "git@github.com:mettio/citeprocessor.git"
}
],
...
"require": {
...
"mett/citeproc":"*"
},
After that, run composer update
in your project root directory.
<?php
include 'vendor/autoload.php';
use \Mett\CiteProc\CiteProc;
$bibliographyStyleName = 'apa';
$lang = "en-US";
$csl = CiteProc::loadStyleSheet($bibliographyStyleName); // xml code of your csl stylesheet
$citeProc = new CiteProc($csl, $lang);
// $data is a JSON encoded string
echo $citeProc->render(json_decode($data));
?>
Run phpunit in the project root and you will be fine.
- Refactor code
- Document code
- Testing
- Document properties
- Implement some missing features