PHP code example of kovenant / yii2-seo-components

1. Go to this page and download the library: Download kovenant/yii2-seo-components library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kovenant / yii2-seo-components example snippets


    /**
     * @return array
     */
    public function behaviors()
    {
        return [
            [
                'class' => \kovenant\seo\SeoModelBehavior::class,
                'route' => ['catalog/item', 'categoryId' => '{category_id}', 'categoryAlias' => '{category.alias}', 'id' => '{id}', 'alias' => '{alias}']
            ],
        ];
    }

    'components' => [
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'suffix' => '.html',
            'rules' => [
                'catalog/<categoryId:\d+>-<categoryAlias>/<id:\d+>-<alias>' => 'catalog/item',
            ],
        ],
    ],

/** yii\db\ActiveRecord $model */
\kovenant\seo\MetaTagsWidget::widget(['component' => $model]);

    'container' => [
        'definitions' => [
            'kovenant\seo\MetaTagsWidget' => [
                // set view attributes
                'viewH1Attribute' => 'h1', /* use <h1><?= $this->h1 

php composer.phar