fgh151 / yii2-opengraph
Add open graph tags
Installs: 2 440
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 5
Forks: 1
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2024-10-28 22:44:59 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';