fgh151/yii2-opengraph

Add open graph tags

Installs: 2 416

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 5

Forks: 1

Open Issues: 0

Type:yii2-extension

v0.0.2 2021-07-20 09:20 UTC

This package is auto-updated.

Last update: 2024-03-28 21:17:23 UTC


README

Add open graph tags

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist fgh151/yii2-opengraph "*"

or add

"fgh151/yii2-opengraph": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, add it to component config :

'components' => [
   'opengraph' => [
       'class' => 'fgh151\opengraph\OpenGraph',
   ],
   //....
],

Then in controller or view set og tags

Yii::$app->opengraph->title = 'My post';
Yii::$app->opengraph->description = 'My post description';
Yii::$app->opengraph->image = 'http://site.ru/image.jpg';