PHPackages                             powerkernel/yii2-jsonld-helper - 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. powerkernel/yii2-jsonld-helper

ActiveYii2-extension

powerkernel/yii2-jsonld-helper
==============================

JsonLD Helper class for Yii2

0.1.0(8y ago)01.5kMITPHP

Since Apr 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/powerkernel/yii2-jsonld-helper)[ Packagist](https://packagist.org/packages/powerkernel/yii2-jsonld-helper)[ RSS](/packages/powerkernel-yii2-jsonld-helper/feed)WikiDiscussions master Synced 1mo ago

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

yii2-jsonld-helper
==================

[](#yii2-jsonld-helper)

Yii2 helper class for registering structured data markup in [JSON-LD](http://json-ld.org/) format.

Resources
---------

[](#resources)

- Yii2 [extension page](http://www.yiiframework.com/extension/yii2-jsonld-helper)
- JSON-LD [documentation](http://json-ld.org/learn.html)
- Google [Structured Data Testing Tool](https://search.google.com/structured-data/testing-tool)

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

[](#installation)

### Composer

[](#composer)

Add extension to your `composer.json` and update your dependencies as usual, e.g. by running `composer update`

```
{
    "require": {
        "powerkernel/yii2-jsonld-helper": "*"
    }
}
```

\##Sample Usage

To let search engines know how to display your website name in search results, you can add the following JSON-LD document somewhere on your landing page:

```
$doc = (object)[
    "@type" => "http://schema.org/WebSite",
    "http://schema.org/name" => Yii::$app->params['brand'],
    "http://schema.org/url" => Yii::$app->urlManager->hostInfo
];

JsonLDHelper::add($doc);
```

You may pass `$context` as an optional second parameter if you need to use something other than default `["@vocab" => "http://schema.org/"]`:

```
JsonLDHelper::add($doc, $context);
```

Note that doing so may cause resulting script to not pass validation by the Google's \[SDTT\] () - refer this this [stackoverflow question](http://stackoverflow.com/questions/35879351/google-structured-data-testing-tool-fails-to-validate-type-as-an-alias-of-type) for details.

You can also use `JsonLDHelper::addBreadcrumbList` to add `BreadcrumbList` schema.org markup based on the application view `breadcrumbs` parameter. E.g. in the beginning of your layout add:

```
JsonLDHelper::addBreadcrumbList();
```

Finally, you must invoke `JsonLDHelper::registerScripts` method in the `` section of your layout, e.g.

```

    head() ?>

```

\###Example with nested data:

```
$doc = [
    "@type" => "http://schema.org/BlogPosting",
    "http://schema.org/mainEntityOfPage" => (object)[
        "@type" => "http://schema.org/WebPage",
        "@id" => "http://example.com/awesome-blog-post",
    ],
    "http://schema.org/headline" => "Post Title",
    "http://schema.org/articleBody" => "Post Body",
    "http://schema.org/author" => (object)[
        "@type" => "http://schema.org/Person",
        "http://schema.org/name" => "Jon Snow",
        "http://schema.org/url" => "http://example.com",
        "http://schema.org/sameAs" => [
            "https://www.instagram.com/kitharingtonn/",
        ]
    ],
];

JsonLDHelper::add($doc);
```

Note that this extension is just a thin wrapper around [lanthaler/JsonLD](https://github.com/lanthaler/JsonLD) processor - refer to this library for the full documentation.

\##License

Extension is released under MIT license.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

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

2950d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f1535362cdc41d7913fd6b29c613bae21718086feab6155bd5e723c8035b403?d=identicon)[powerkernel](/maintainers/powerkernel)

---

Top Contributors

[![harrytang](https://avatars.githubusercontent.com/u/792413?v=4)](https://github.com/harrytang "harrytang (7 commits)")[![nirvana-msu](https://avatars.githubusercontent.com/u/5787387?v=4)](https://github.com/nirvana-msu "nirvana-msu (6 commits)")

---

Tags

yii2jsonld

### Embed Badge

![Health badge](/badges/powerkernel-yii2-jsonld-helper/health.svg)

```
[![Health](https://phpackages.com/badges/powerkernel-yii2-jsonld-helper/health.svg)](https://phpackages.com/packages/powerkernel-yii2-jsonld-helper)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[simialbi/yii2-schema-org

Schema.org yii2 representation and helpers for json-ld generation in Yii framework

18102.7k4](/packages/simialbi-yii2-schema-org)

PHPackages © 2026

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