PHP code example of rikipm / yii2-oggenerator

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

    

rikipm / yii2-oggenerator example snippets


'oggenerator'=>[
            'class' => 'rikipm\oggenerator',

            'locale' => 'en-US', //Its "og:locale" tag for all pages
            'site_name' => 'MySite',  //Its "og:site_name" tag for all pages

            'attr_title' => 'title',
            'attr_type' => 'type',
            'attr_image' => 'image',
            'attr_image_alt' => 'image_alt',
            'attr_description' => 'description',
        ],

public function actionView($id)
{
  $model = Model::findOne(['id' => $id]);

  Yii::$app->oggenerator->generate($model);
  return $this->render('view', ['model' => $model]);
}