PHP code example of cinghie / yii2-seo-component

1. Go to this page and download the library: Download cinghie/yii2-seo-component 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/ */

    

cinghie / yii2-seo-component example snippets


$ php composer.phar 

Yii::$app->seo->setMetaTags([
    'title' => $this->title, // default: $this->title
    'author' => '', // default: Yii::$app->settings->get('siteAuthor', 'Configurations')
    'copyright' => '', // default: Yii::$app->settings->get('siteCopyright', 'Configurations') 
    'description' => '', // default: Yii::$app->settings->get('siteDescription', 'Configurations')
    'keywords' => '', // default: Yii::$app->settings->get('siteKeywords', 'Configurations')
    'robots' => '',
]);

Yii::$app->seo->setOpenGraph([
    'title' => $this->title, // default: $this->title
    'description' => '', // default: Yii::$app->settings->get('siteDescription', 'Configurations')
    'image' => $this->image, // default: null
    'sitename' => '', // default: Yii::$app->settings->get('siteName', 'Configurations')
    'type' => 'article', // default: 'article'
    'url' => '', // default: Yii::$app->request->absoluteUrl
]);