PHPackages                             sbs/yii2-seo - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sbs/yii2-seo

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

sbs/yii2-seo
============

The module allows link SEO fields to model.

1.0.0(6y ago)00BSD-3-ClausePHPPHP &gt;=7.2

Since Apr 23Pushed 6y ago1 watchersCompare

[ Source](https://github.com/koftikes/yii2-seo)[ Packagist](https://packagist.org/packages/sbs/yii2-seo)[ Docs](https://github.com/koftikes/yii2-seo)[ RSS](/packages/sbs-yii2-seo/feed)WikiDiscussions master Synced today

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

Yii2-Seo
========

[](#yii2-seo)

The module provides an ability to add SEO fields to Model. Fields: title, keywords, description.

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

[](#installation)

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

Either run

```
composer require sbs/yii2-seo
```

or add to the require section of your application's `composer.json` file next line

```
"sbs/yii2-seo": "^1.0"
```

and run

```
composer update
```

Migrations
----------

[](#migrations)

For add table, to DataBase, you can run next command

```
php yii migrate/up --migrationPath=vendor/sbs/yii2-seo/src/migrations
```

or you can configure your application's `config\console.php`

*This method more preferable because you can run all standard migrations commands.*

```
'controllerMap' => [
    'migrate' => [
        'class' => MigrateController::class,
        'migrationPath' => [
            '@console/migrations',
            '@vendor/sbs/yii2-seo/src/migrations',
        ],
        //...
    ],
    //...
]
```

Use with Model
--------------

[](#use-with-model)

You need to add behaviors to model:

```
use sbs\behaviors\SeoBehavior;

function behaviors()
{
    return [
    //...
        SeoBehavior::class,
    //...
    ];
}
```

Now all fields will be available by $model-&gt;seo.

For add/edit fields in model form view use next widget:

```
//...
use sbs\widgets\SeoForm;
//...
?>

    //...

    //...
