{"id":14966862,"url":"https://github.com/yiier/yii2-seo","last_synced_at":"2026-01-24T10:34:17.066Z","repository":{"id":57087114,"uuid":"238620274","full_name":"yiier/yii2-seo","owner":"yiier","description":"SEO For Yii2","archived":false,"fork":false,"pushed_at":"2020-02-06T06:40:56.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-09T04:11:38.592Z","etag":null,"topics":["yii2-extension","yii2-seo"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yiier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-06T06:10:36.000Z","updated_at":"2023-03-24T13:43:38.000Z","dependencies_parsed_at":"2022-08-24T14:00:23.992Z","dependency_job_id":null,"html_url":"https://github.com/yiier/yii2-seo","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/yiier/yii2-seo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiier%2Fyii2-seo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiier%2Fyii2-seo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiier%2Fyii2-seo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiier%2Fyii2-seo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yiier","download_url":"https://codeload.github.com/yiier/yii2-seo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiier%2Fyii2-seo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28725374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["yii2-extension","yii2-seo"],"created_at":"2024-09-24T13:37:03.658Z","updated_at":"2026-01-24T10:34:17.049Z","avatar_url":"https://github.com/yiier.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"SEO For Yii2\n============\nLibrary for working with SEO parameters of models\n\n[![Latest Stable Version](https://poser.pugx.org/yiier/yii2-seo/v/stable)](https://packagist.org/packages/yiier/yii2-seo) \n[![Total Downloads](https://poser.pugx.org/yiier/yii2-seo/downloads)](https://packagist.org/packages/yiier/yii2-seo) \n[![Latest Unstable Version](https://poser.pugx.org/yiier/yii2-seo/v/unstable)](https://packagist.org/packages/yiier/yii2-seo) \n[![License](https://poser.pugx.org/yiier/yii2-seo/license)](https://packagist.org/packages/yiier/yii2-seo)\n\n\nInstallation\n------------\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\nphp composer.phar require --prefer-dist yiier/yii2-seo \"*\"\n```\n\nor add\n\n```\n\"yiier/yii2-seo\": \"*\"\n```\n\nto the require section of your `composer.json` file.\n\nConfiguration\n-----\n\nchange your config file\n\n```php\n\u003c?php\nreturn [\n    'components' =\u003e [\n        'view' =\u003e [\n            'as seo' =\u003e [\n                'class' =\u003e 'yiier\\seo\\SeoViewBehavior',\n                'names' =\u003e [\n\n                    'keywords' =\u003e 'blog,forecho',\n                    'author' =\u003e getenv('APP_NAME'),\n                ],\n                'properties' =\u003e [\n                    [\n                        'property' =\u003e ['title', 'og:title'],\n                        'content' =\u003e function () {\n                            return ' tag1, tag2';\n                        },\n                    ],\n                    'title1' =\u003e 'title'\n                ],\n            ]\n        ]\n    ]\n];\n```\n\n\nIn model file add seo model behavior:\n\n```php\n\u003c?php\n\npublic function behaviors()\n{\n    return [\n        'seo' =\u003e [\n            'class' =\u003e 'yiier\\seo\\SeoModelBehavior',\n            'names' =\u003e [\n                'viewport' =\u003e function (self $model) {\n                    return $model-\u003etitle . ', tag1, tag2';\n                },\n                'keywords' =\u003e 'blog,forecho',\n                'author' =\u003e 'author', // model field\n            ],\n            'properties' =\u003e [\n                [\n                    'property' =\u003e ['title', 'og:title'],\n                    'content' =\u003e function (self $model) {\n                        return $model-\u003etitle . ', tag1, tag2';\n                    },\n                ],\n                'title1' =\u003e 'title',\n                [\n                    'property' =\u003e 'description',\n                    'content' =\u003e function (self $model) {\n                        return $model-\u003etitle . ', tag1, tag2';\n                    },\n                ],\n            ],\n        ],\n    ];\n}\n```\n\nPHPdoc for model:\n\n```\n/**\n * @property \\yiier\\seo\\SeoModelBehavior $seoBehavior\n * @method \\yiier\\seo\\SeoModelBehavior getSeoBehavior()\n */\n```\n\nChange `/frontend/views/layouts/main.php`:\n\n```php\n\u003c?php\n/* @var $this \\yii\\web\\View|\\yiier\\seo\\SeoViewBehavior */\n?\u003e\n\u003chead\u003e\n    \u003c!-- Replace default \u003ctitle\u003e tag --\u003e    \n    \u003ctitle\u003e\u003c?= Html::encode($this-\u003etitle) ?\u003e\u003c/title\u003e\n    \u003c!-- by this line: --\u003e    \n    \u003c?php $this-\u003erenderMetaTags(); ?\u003e\n    ...\n\u003c/head\u003e\n```\n\nUsage\n-----\n\nIn \"view.php\" file for model:\n\n```php\n// set SEO:meta data for current page\n$this-\u003esetSeoData($model-\u003egetSeoBehavior());\n```\n\n\nor in controller:\n\n```php\n Yii::$app-\u003eview-\u003esetSeoData($model-\u003egetSeoBehavior());\n```\n\nSimple url rules example in '/frontend/config/main.php':\n\n```php\n'urlManager' =\u003e [\n    'enablePrettyUrl' =\u003e true,\n    'showScriptName' =\u003e false,\n    'rules' =\u003e [\n        '\u003ccontroller:\\w+\u003e/\u003caction:\\w+\u003e/\u003cid:\\d+\u003e' =\u003e '\u003ccontroller\u003e/\u003caction\u003e',\n        '\u003cmodule\u003e/\u003ccontroller:\\w+\u003e/\u003caction:\\w+\u003e/\u003cid:\\d+\u003e' =\u003e '\u003cmodule\u003e/\u003ccontroller\u003e/\u003caction\u003e',\n        'post/\u003caction:(index|create|update|delete)\u003e' =\u003e 'post/\u003caction\u003e',\n        'post/\u003ctitle:[-\\w]+\u003e' =\u003e 'post/view',\n    ],\n],\n```\n\nReference\n-----\n\n[demisang/yii2-seo](https://github.com/demisang/yii2-seo)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiier%2Fyii2-seo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyiier%2Fyii2-seo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiier%2Fyii2-seo/lists"}