PHPackages                             simialbi/yii2-schema-org - 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. simialbi/yii2-schema-org

ActiveYii2-extension

simialbi/yii2-schema-org
========================

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

3.0.1(2y ago)18102.7k↓36%4[1 issues](https://github.com/simialbi/yii2-schema-org/issues)4MITPHPPHP &gt;=7.3

Since Aug 11Pushed 2y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (4)Versions (15)Used By (4)

yii2-schema-org
===============

[](#yii2-schema-org)

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

[![Latest Stable Version](https://camo.githubusercontent.com/5c1115dfa271ba5267dbd4ee305e9e1c25ace5f997805abf5ae81ad6ef75ccf8/68747470733a2f2f706f7365722e707567782e6f72672f73696d69616c62692f796969322d736368656d612d6f72672f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/simialbi/yii2-schema-org)[![Total Downloads](https://camo.githubusercontent.com/12818f1c33e59f3d64c30e9a67da308f3a36f0853ae5a830d6ef1b6cd05d1a15/68747470733a2f2f706f7365722e707567782e6f72672f73696d69616c62692f796969322d736368656d612d6f72672f646f776e6c6f6164733f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/simialbi/yii2-schema-org)[![Build Status](https://github.com/simialbi/yii2-schema-org/workflows/build/badge.svg)](https://github.com/simialbi/yii2-schema-org/workflows/build/badge.svg)[![License](https://camo.githubusercontent.com/f71000b55fc147776e8af2be564fab24eb11151b2a1b527e3cb96f3a29c57bb2/68747470733a2f2f706f7365722e707567782e6f72672f73696d69616c62692f796969322d736368656d612d6f72672f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/simialbi/yii2-schema-org)

Resources
---------

[](#resources)

- JSON-LD [documentation](http://json-ld.org/learn.html)
- Google [Structured Data Testing Tool](https://search.google.com/structured-data/testing-tool)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ php composer.phar require --prefer-dist simialbi/yii2-schema-org
```

or add

```
"simialbi/yii2-schema-org": "^2.0.0"

```

to the `require` section of your `composer.json`

Usage
-----

[](#usage)

In order to use this module, you will need to:

1. [Configure](#setup-module) your application so that the module is available.
2. [Generate](#model-generation) the Schemas you intend to use.

### Setup Module

[](#setup-module)

Configure the module named `schema` in the modules section of your Yii configuration file.

> Remember to do this for console and for web application configuration file.

```
'modules' => [
	'schema' => [
		'class' => 'simialbi\yii2\schemaorg\Module',
		//'autoCreate' => false,
		//'autoRender' => false
	]
]
```

Also add the module `schema` to the bootstrap section of your configuration file:

```
'bootstrap' => ['log', 'schema']
```

ParameterDescription`autoCreate`Automatically create breadcrumbs `json+ld` data.`autoRender`Automatically render `json+ld` data at the end of body section.`mergeModels`Merge models into one script tag instead of rendering one for each of them.*If you don't use `autoRender`, be sure to manually call `JsonLDHelper::render()` in your layout file, like so:*

```
