{"id":22640421,"url":"https://github.com/simialbi/yii2-schema-org","last_synced_at":"2025-10-11T04:08:13.502Z","repository":{"id":47898780,"uuid":"99892816","full_name":"simialbi/yii2-schema-org","owner":"simialbi","description":"Schema.org yii2 representation and helpers for json-ld generation","archived":false,"fork":false,"pushed_at":"2023-10-09T13:32:52.000Z","size":401,"stargazers_count":17,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T04:08:10.824Z","etag":null,"topics":["json-ld","jsonld","microdata","schema-org","structured-data","yii2"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simialbi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-10T07:10:46.000Z","updated_at":"2024-08-31T04:41:36.000Z","dependencies_parsed_at":"2024-06-20T19:14:42.962Z","dependency_job_id":null,"html_url":"https://github.com/simialbi/yii2-schema-org","commit_stats":{"total_commits":94,"total_committers":5,"mean_commits":18.8,"dds":0.4042553191489362,"last_synced_commit":"6516a4ef1232f75ef15a26fe5c63472c0e45a959"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/simialbi/yii2-schema-org","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simialbi%2Fyii2-schema-org","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simialbi%2Fyii2-schema-org/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simialbi%2Fyii2-schema-org/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simialbi%2Fyii2-schema-org/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simialbi","download_url":"https://codeload.github.com/simialbi/yii2-schema-org/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simialbi%2Fyii2-schema-org/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006258,"owners_count":26084060,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json-ld","jsonld","microdata","schema-org","structured-data","yii2"],"created_at":"2024-12-09T04:10:21.995Z","updated_at":"2025-10-11T04:08:13.475Z","avatar_url":"https://github.com/simialbi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yii2-schema-org\n\nSchema.org yii2 representation and helpers for json-ld generation.\n\n[![Latest Stable Version](https://poser.pugx.org/simialbi/yii2-schema-org/v/stable?format=flat-square)](https://packagist.org/packages/simialbi/yii2-schema-org)\n[![Total Downloads](https://poser.pugx.org/simialbi/yii2-schema-org/downloads?format=flat-square)](https://packagist.org/packages/simialbi/yii2-schema-org)\n![Build Status](https://github.com/simialbi/yii2-schema-org/workflows/build/badge.svg)\n[![License](https://poser.pugx.org/simialbi/yii2-schema-org/license?format=flat-square)](https://packagist.org/packages/simialbi/yii2-schema-org)\n\n## Resources\n * JSON-LD [documentation](http://json-ld.org/learn.html)\n * Google [Structured Data Testing Tool](https://search.google.com/structured-data/testing-tool)\n \n## Installation\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```bash\n$ php composer.phar require --prefer-dist simialbi/yii2-schema-org\n```\n\nor add \n\n```\n\"simialbi/yii2-schema-org\": \"^2.0.0\"\n```\n\nto the ```require``` section of your `composer.json`\n\n\n## Usage\n\nIn order to use this module, you will need to:\n\n1. [Configure](#setup-module) your application so that the module is available.\n2. [Generate](#model-generation) the Schemas you intend to use.\n\n### Setup Module\n\nConfigure the module named `schema` in the modules section of your Yii configuration file.\n\n\u003e Remember to do this for console and for web application configuration file.\n\n```php\n'modules' =\u003e [\n\t'schema' =\u003e [\n\t\t'class' =\u003e 'simialbi\\yii2\\schemaorg\\Module',\n\t\t//'autoCreate' =\u003e false,\n\t\t//'autoRender' =\u003e false\n\t]\n]\n```\n\nAlso add the module `schema` to the bootstrap section of your configuration file:\n```php\n'bootstrap' =\u003e ['log', 'schema']\n```\n\n| Parameter      | Description                                                                 |\n|----------------|-----------------------------------------------------------------------------|\n| `autoCreate`   | Automatically create breadcrumbs `json+ld` data.                            | \n| `autoRender`   | Automatically render `json+ld` data at the end of body section.             |\n| `mergeModels`  | Merge models into one script tag instead of rendering one for each of them. |\n\n*If you don't use `autoRender`, be sure to manually call `JsonLDHelper::render()` in your layout file, like so:*\n\n\n```php\n\u003c?php\n/* @var $this \\yii\\web\\View */\n/* @var $content string */\nuse yii\\helpers\\Html;\nuse app\\assets\\AppAsset;\nuse simialbi\\yii2\\schemaorg\\helpers\\JsonLDHelper;\n\nAppAsset::register($this);\n?\u003e\n\u003c?php $this-\u003ebeginPage() ?\u003e\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"\u003c?= Yii::$app-\u003elanguage ?\u003e\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"\u003c?= Yii::$app-\u003echarset ?\u003e\"\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\"\u003e\n    \u003c?= Html::csrfMetaTags() ?\u003e\n    \u003ctitle\u003e\u003c?= Html::encode($this-\u003etitle) ?\u003e\u003c/title\u003e\n    \u003c?php JsonLDHelper::render(); ?\u003e\n    \u003c?php $this-\u003ehead() ?\u003e\n\u003c/head\u003e\n```  \n\n### Model generation\n\n#### Minimal (standard) configuration\n\nWithout passing any parameters **all** schemas will be generated in the folder `@vendor/simialbi/yii2-schema-org/src/models`.\nThe namespace of the models will be `simialbi\\yii2\\schemaorg\\models`.\n```bash\n$ php yii schema/models/generate\n```\n\n#### Customized\n\nIf you want to customize the namespace and path you can do it via `--namespace` and `--folder` parameters. E.g. to generate\nschemas `Car` and `AutoDealer` in `common/schemas` with `common\\schemas` namespace: \n ```bash\n$ php yii schema/models/generate 'latest' --schemas=Car,AutoDealer --namespace='common\\schemas' --folder='@common/schemas/'\n```\n\n| Parameter      | Description                                                                                              |\n|----------------|----------------------------------------------------------------------------------------------------------|\n| `version`      | The [schemas.org version](https://schema.org/docs/releases.html) to use. Defaults to `latest`            | \n| `--schemas`    | A comma separated list of schemas you intend to use. Empty means all. Defaults to `[]`                   |\n| `--namespace`  | The namespace to use for the generated classes and traits. Defaults to `simialbi\\yii2\\schemaorg\\models`  |\n| `--folder`     | The folder where to put the generated files. Defaults to `@simialbi/yii2/schemaorg/src/models`           |\n| `--remove-old` | Whether to remove old files before generating. Defaults to `false`                                       |\n\nThe console command will take care of computing schemas dependencies and will generate the classes based on your needs.\n\n### Automatic model update on composer update\nIf you'd like to always update your schema when you run `composer update` you can configure your composer.json like this:\n```json\n{\n  // [...]\n  \"require\": {\n    \"yiisoft/yii2\": \"^2.0.13\",\n    \"simialbi/yii2-schema-org\": \"^2.0.0\"\n  },\n  \"scripts\": {\n    \"post-update-cmd\": [\n      \"simialbi\\\\yii2\\\\schemaorg\\\\composer\\\\Installer::postInstallUpdate\"\n    ]\n  },\n  \"extra\": {\n    \"simialbi\\\\yii2\\\\schemaorg\\\\composer\\\\Installer::postInstallUpdate\": {\n      \"generateModels\": {\n        \"schemas\": [\"Car\", \"AutoDealer\"], // optional\n        \"namespace\": \"common\\\\schemas\", // optional\n        \"folder\": \"common/schema\" // optional\n      }\n    }\n  }\n  // [...]\n}\n```\n\n## Example Usage\nTo e.g. add a person to json+ld, you can do the following:\n\n```php\nuse simialbi\\yii2\\schemaorg\\helpers\\JsonLDHelper;\nuse simialbi\\yii2\\schemaorg\\models\\Person;\n\n$child = new Person();\n$child-\u003ename = 'George W. Bush';\n$child-\u003edisambiguatingDescription = '43rd President of the United States';\n$person = new Person();\n$person-\u003ename = 'George Bush';\n$person-\u003edisambiguatingDescription = '41st President of the United States';\n$person-\u003echildren = [$child];\n\nJsonLDHelper::add($person);\n``` \n\n## License\n\n**yii2-schema-org** is released under MIT license. See bundled [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimialbi%2Fyii2-schema-org","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimialbi%2Fyii2-schema-org","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimialbi%2Fyii2-schema-org/lists"}