PHPackages                             rudolfbyker/php-marc-csl - 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. rudolfbyker/php-marc-csl

ActiveLibrary

rudolfbyker/php-marc-csl
========================

description

1.0.0(4y ago)13.0kMITPHPPHP &gt;=7.3

Since Oct 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/rudolfbyker/php-marc-csl)[ Packagist](https://packagist.org/packages/rudolfbyker/php-marc-csl)[ RSS](/packages/rudolfbyker-php-marc-csl/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Convert MARC records to CSL variables in CSL-JSON format using PHP
==================================================================

[](#convert-marc-records-to-csl-variables-in-csl-json-format-using-php)

This package tries to map MARC21 records to CSL variables. There is no official or industry standard mapping. We develop our mapping on our interpretation of:

- the [MARC21 docs](https://www.loc.gov/marc/bibliographic/)
- the [CSL docs](https://docs.citationstyles.org/en/stable/specification.html)
- the [Citeproc JS docs](https://citeproc-js.readthedocs.io/en/latest/index.html), especially the [CSL-JSON](https://citeproc-js.readthedocs.io/en/latest/csl-json/markup.html) part.

To see which MARC fields maps to which CSL variables, look at the [documentation](https://rudolfbyker.github.io/php-marc-csl/classes/RudolfByker-PhpMarcCsl-MarcCslVariables.html)or [source code](https://github.com/rudolfbyker/php-marc-csl/blob/master/src/MarcCslVariables.php)of the `MarcCslVariables` class, especially the `getAll()` method.

Example usage:
--------------

[](#example-usage)

```
// Get a MARC record (e.g. from an XML file)
$record = Record::fromSimpleXMLElement(simplexml_load_file("marc/xml/35663.xml"));

// Wrap the record in the class provided by this package.
$marcCsl = new MarcCslVariables($record);

// Get the CSL variables as a PHP data structure.
$csl_variables = $csl_variables->jsonSerialize();

// Get the CSL variables as a CSL-JSON string.
$json_string = json_encode($csl_variables);
```

From here, you can use the CSL JSON string as input for something like CiteProc-JS or CiteProc-PHP in order to generate bibliographies and citations.

Installing
----------

[](#installing)

```
composer require rudolfbyker/php-marc-csl
```

Running unit tests
------------------

[](#running-unit-tests)

```
composer install
composer test
```

Reporting bugs
--------------

[](#reporting-bugs)

If your data is mapped incorrectly, create an issue or PR, and provide:

- the input MARC data
- the actual output
- the expected output
- links to relevant CSL and MARC documentation
- suggestions for how to fix it

Generating docs
---------------

[](#generating-docs)

1. Download phpDocumentor. According to , we should not install phpDocumentor using composer. Follow the instructions there to install it.
2. Remove the old docs dir: `rm -rf docs`.
3. Run `phpDocumentor.phar` to generate new docs.
4. Commit generated docs. Docs committed to the repository should be available on Github pages: [https://github.com/rudolfbyker/php-marc-csl/deployments/activity\_log?environment=github-pages](https://github.com/rudolfbyker/php-marc-csl/deployments/activity_log?environment=github-pages)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

1669d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f8bcb100ec861f464f708867f5a1352ee69d3e9aeab1f536774443424f5dab11?d=identicon)[rudolfbyker](/maintainers/rudolfbyker)

---

Top Contributors

[![rudolfbyker](https://avatars.githubusercontent.com/u/10025342?v=4)](https://github.com/rudolfbyker "rudolfbyker (40 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rudolfbyker-php-marc-csl/health.svg)

```
[![Health](https://phpackages.com/badges/rudolfbyker-php-marc-csl/health.svg)](https://phpackages.com/packages/rudolfbyker-php-marc-csl)
```

PHPackages © 2026

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