定制 academicpuma/citeproc-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

academicpuma/citeproc-php

最新稳定版本:1.0.0

Composer 安装命令:

composer require academicpuma/citeproc-php

包简介

This is an effort to implement a full-featured standalone CSL processor in PHP. The code based on the implementation of Ron Jerome.

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Build Status

Description

This is an 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 rjerome (apparently no longer maintained).

Some advantages:

  • uses Composer
  • each class is located in a separate file
  • uses namespaces
  • uses the autoloader of Composer
  • uses PHPUnit for testing

Installing citeproc-php using Composer

Use Composer to add citeproc-php to your app:

$ composer require academicpuma/citeproc-php

How to use citeproc-php

<?php
include 'vendor/autoload.php';
use \AcademicPuma\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));
?>

Setup a workspace

$ cd /path/to/your/php/workspace
$ hg clone https://seboettg@bitbucket.org/seboettg/citeproc-php
$ composer install

You can setup your apache to see the test results on a webpage. Therefor you can configure your apache with an custom virtual host:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName citeproc.local
        DocumentRoot /path/to/your/php/workspace/citeproc-php/tests
        ErrorLog "/var/log/apache2/citeproc.error.log"
        CustomLog "/var/log/apache2/citeproc.access.log" common

        <Directory /path/to/your/php/workspace/citeproc-php/tests>
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

Replace '/path/to/your/php/workspace/' with your path and replace 'citeproc.local' with your favourite host name.

If you want to use your own host address don't forget to append them to /etc/hosts:

127.0.0.1       citeproc.local localhost

Restart your apache

$ sudo apachectl restart

or

$ sudo /etc/init.d/apache2 restart

Open your browser and enter your chosen host address, as soon as apache has finished.

Known packages using citeproc-php

统计信息

  • 总下载量: 376.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 1

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL
  • 更新时间: 2015-01-02