PHPackages                             conjecto/json-ld - 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. conjecto/json-ld

ActiveLibrary

conjecto/json-ld
================

JSON-LD Processor for PHP

1.0.3(11y ago)21.1kMITPHPPHP &gt;=5.3.0

Since Mar 5Pushed 10y ago5 watchersCompare

[ Source](https://github.com/conjecto/JsonLD)[ Packagist](https://packagist.org/packages/conjecto/json-ld)[ Docs](http://www.markus-lanthaler.com)[ RSS](/packages/conjecto-json-ld/feed)WikiDiscussions master Synced 1mo ago

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

JsonLD [![Build Status](https://camo.githubusercontent.com/e6ea72dcf344211b55f923a86d8d82d4a2aea3a3228e0402f2197f3d97c758b3/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6c616e7468616c65722f4a736f6e4c442e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/lanthaler/JsonLD)
===================================================================================================================================================================================================================================================================================================

[](#jsonld-)

JsonLD is a fully conforming [JSON-LD](http://www.w3.org/TR/json-ld/)processor written in PHP. It is extensively tested and passes the [official JSON-LD test suite](https://github.com/json-ld/tests).

There's an [online playground](http://www.markus-lanthaler.com/jsonld/playground/)where you can evaluate the processor's basic functionality.

Additionally to the features defined by the [JSON-LD API specification](http://www.w3.org/TR/json-ld-api/), JsonLD supports [framing](http://json-ld.org/spec/latest/json-ld-framing/)(including [value matching](https://github.com/json-ld/json-ld.org/issues/110), [deep-filtering](https://github.com/json-ld/json-ld.org/issues/110), [aggressive re-embedding](https://github.com/json-ld/json-ld.org/issues/119), and [named graphs](https://github.com/json-ld/json-ld.org/issues/118)) and an experimental [object-oriented interface for JSON-LD documents](https://github.com/lanthaler/JsonLD/issues/15).

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

[](#installation)

The easiest way to use JsonLD is to integrate it as a dependency in your project's [composer.json](https://getcomposer.org/) file:

```
{
    "require": {
        "ml/json-ld": "1.*"
    }
}
```

Installing is then a matter of running composer

```
php composer.phar install

```

... and including Composer's autoloader to your project

```
require('vendor/autoload.php');
```

Of course, you can also download JsonLD as [ZIP archive](https://github.com/lanthaler/JsonLD/releases) from Github.

JsonLD requires PHP 5.3 or later.

Usage
-----

[](#usage)

The library supports the official [JSON-LD API](http://www.w3.org/TR/json-ld-api/) as well as a object-oriented interface for JSON-LD documents (not fully implemented yet, see [issue #15](https://github.com/lanthaler/JsonLD/issues/15) for details).

All classes are extensively documented. Please have a look at the source code.

```
// Official JSON-LD API
$expanded = JsonLD::expand('document.jsonld');
$compacted = JsonLD::compact('document.jsonld', 'context.jsonld');
$framed = JsonLD::frame('document.jsonld', 'frame.jsonld');
$flattened = JsonLD::flatten('document.jsonld');
$quads = JsonLD::toRdf('document.jsonld');

// Output the expanded document (pretty print)
print JsonLD::toString($expanded, true);

// Serialize the quads as N-Quads
$nquads = new NQuads();
$serialized = $nquads->serialize($quads);
print $serialized;

// And parse them again to a JSON-LD document
$quads = $nquads->parse($serialized);
$document = JsonLD::fromRdf($quads);

print JsonLD::toString($document, true);

// Node-centric API
$doc = JsonLD::getDocument('document.jsonld');

// get the default graph
$graph = $doc->getGraph();

// get all nodes in the graph
$nodes = $graph->getNodes();

// retrieve a node by ID
$node = $graph->getNode('http://example.com/node1');

// get a property
$node->getProperty('http://example.com/vocab/name');

// add a new blank node to the graph
$newNode = $graph->createNode();

// link the new blank node to the existing node
$node->addPropertyValue('http://example.com/vocab/link', $newNode);

// even reverse properties are supported; this returns $newNode
$node->getReverseProperty('http://example.com/vocab/link');

// serialize the graph and convert it to a string
$serialized = JsonLD::toString($graph->toJsonLd());
```

Commercial Support
------------------

[](#commercial-support)

Commercial support is available on request.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 98.2% 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

Every ~59 days

Total

4

Last Release

4263d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/033fab9c50233f1ec2320281d5f4e19425b286afd98c420a108140e8d374aad5?d=identicon)[bdecarne](/maintainers/bdecarne)

---

Top Contributors

[![lanthaler](https://avatars.githubusercontent.com/u/456407?v=4)](https://github.com/lanthaler "lanthaler (324 commits)")[![serwan](https://avatars.githubusercontent.com/u/5001766?v=4)](https://github.com/serwan "serwan (4 commits)")[![conjectwan](https://avatars.githubusercontent.com/u/9654192?v=4)](https://github.com/conjectwan "conjectwan (2 commits)")

---

Tags

JSON-LDjsonld

### Embed Badge

![Health badge](/badges/conjecto-json-ld/health.svg)

```
[![Health](https://phpackages.com/badges/conjecto-json-ld/health.svg)](https://phpackages.com/packages/conjecto-json-ld)
```

###  Alternatives

[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k48.1M236](/packages/api-platform-core)[ml/json-ld

JSON-LD Processor for PHP

3446.4M38](/packages/ml-json-ld)[artesaos/seotools

SEO Tools for Laravel and Lumen

3.3k5.1M60](/packages/artesaos-seotools)[digitalbazaar/json-ld

A JSON-LD Processor and API implementation in PHP.

28555.4k1](/packages/digitalbazaar-json-ld)[nystudio107/craft-seomatic

SEOmatic facilitates modern SEO best practices &amp; implementation for Craft CMS 5. It is a turnkey SEO system that is comprehensive, powerful, and flexible.

1741.4M46](/packages/nystudio107-craft-seomatic)[torann/json-ld

Extremely simple JSON-LD markup generator.

149620.7k1](/packages/torann-json-ld)

PHPackages © 2026

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