PHPackages                             lakshay/converter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. lakshay/converter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lakshay/converter
=================

A small library to convert different bibliography formats into each other

v1.0.5(5y ago)06MITPHPPHP &gt;=5.4.0

Since Aug 10Pushed 5y agoCompare

[ Source](https://github.com/lakshayverma/converter)[ Packagist](https://packagist.org/packages/lakshay/converter)[ Docs](https://github.com/lakshayverma/converter)[ RSS](/packages/lakshay-converter/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (4)Used By (0)

Converter
---------

[](#converter)

A small library to convert the input data for different literature standards like BibTeX, CSL etc. into each other. At the moment are supported [BibTeX](http://en.wikipedia.org/wiki/BibTeX "BibTeX"), [CSL](http://citationstyles.org/ "CSL") and [RIS](http://en.wikipedia.org/wiki/RIS_(file_format) "RIS").

Installation
------------

[](#installation)

### Via [composer](http://getcomposer.org/ "composer")

[](#via-composer)

Add to the `composer.json` the `require` key and run composer install.

```
    "require" : {
        "lakshay/converter": "dev-master"
    }

```

### Other

[](#other)

Make sure you are using a [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md "PSR-2")compatible autoloader.

Usage
-----

[](#usage)

To convert form one standard to an other:

```
    // include the composer autoloader
    require __DIR__ . '/vendor/autoload.php';

    use Lakshay\Converter\Converter;
    use Lakshay\Converter\Standard\RIS\RIS;
    use Lakshay\Converter\Standard\BibTeX\BibTeX;
    use Lakshay\Converter\Standard\CSL\CSL;

    $converter  =   new Converter();

    // your input RIS data
    $data = 'TY  - JOUR
             TI  - Die Grundlage der allgemeinen Relativitätstheorie
             AU  - Einstein, Albert
             PY  - 1916
             SP  - 769
             EP  - 822
             JO  - Annalen der Physik
             VL  - 49
             ER  - ';

    // convert to bibTeX
    $bibTeX =   $converter->convert(new RIS($data), new BibTeX());

    /**
     * $bibTeX now has the following value:
     *
     * @article{article,
     *      author = {Einstein, Albert},
     *      year = {1916},
     *      pages = {769-822},
     *      title = {Die Grundlage der allgemeinen Relativitätstheorie},
     *      volume = {49}
     * }
     */

     // or convert bibTeX to csl
     $csl   =   $converter->convert(new BibTeX($bibTeX), new CSL());

     /**
      * $csl now has the following value (a UTF-8 encoded json string):
      *
      * [
      *     {
      *         "type":"article",
      *         "author":[{
      *             "family":"Einstein",
      *             "given":"Albert"
      *         }],
      *         "issued":[{
      *             "year":"1916"
      *         }],
      *         "page":"769-822",
      *         "page-first":"769",
      *         "citation-label":"article",
      *         "title":"Die Grundlage der allgemeinen Relativit\u00e4tstheorie"
      *     }
      * ]
      */
```

Limitations
-----------

[](#limitations)

The built-in BibTeX converter has the following limitations:

- Non-UTF-8 strings are converted to UTF-8
- LaTeX escape sequences are converted to UTF-8 characters
- Enclosing braces are discarded. (Neither CSL nor RIS support explicit capitalisation.)

Adding a standard
-----------------

[](#adding-a-standard)

To implement a new standard is quite simple:

1. Create a copy of the folder **src/Lakshay/Converter/Standard/Template**
2. Change the name to the new standard.
3. Rename also the **Template.php** file to the name of the standard
4. Replace every occurence of **Template** in the files **Creator.php**, **Parser.php** and **Template.php** with the name of the new standard.
5. Implement the methods **create** and **retrieve** in **Creator.php**
6. Implement the methods **parse** and **retrieve** in **Parser.php**
7. Don't forget to write your PHPUnit tests and follow the [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md "PSR-2") coding standard

Tests
-----

[](#tests)

Converter depends on PHPUnit. Ensure that your dependencies are up to date by running `composer update` then call `vendor\bin\phpunit tests` to run all the tests.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2152d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1487999?v=4)[Lakshay](/maintainers/lakshay)[@lakshay](https://github.com/lakshay)

---

Top Contributors

[![lakshayverma](https://avatars.githubusercontent.com/u/10485696?v=4)](https://github.com/lakshayverma "lakshayverma (20 commits)")[![OrkneyDullard](https://avatars.githubusercontent.com/u/5255642?v=4)](https://github.com/OrkneyDullard "OrkneyDullard (15 commits)")[![geissler](https://avatars.githubusercontent.com/u/535572?v=4)](https://github.com/geissler "geissler (12 commits)")[![burki](https://avatars.githubusercontent.com/u/464455?v=4)](https://github.com/burki "burki (3 commits)")[![BlueM](https://avatars.githubusercontent.com/u/1493457?v=4)](https://github.com/BlueM "BlueM (1 commits)")[![daviian](https://avatars.githubusercontent.com/u/5477981?v=4)](https://github.com/daviian "daviian (1 commits)")[![ShadyChars](https://avatars.githubusercontent.com/u/39190388?v=4)](https://github.com/ShadyChars "ShadyChars (1 commits)")

---

Tags

BibliographybibtexRIScslendnote

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lakshay-converter/health.svg)

```
[![Health](https://phpackages.com/badges/lakshay-converter/health.svg)](https://phpackages.com/packages/lakshay-converter)
```

###  Alternatives

[in2code/publications

Publication reference extension with im- and export with bibtex and xml files

1145.7k](/packages/in2code-publications)[renanbr/bibtex-parser

BibTex Parser provides an API to read .bib files programmatically

39460.4k20](/packages/renanbr-bibtex-parser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
