dev-master
9999999-devlib to work with OpenGraph
MIT
The Development Requires
by Dmytro Sokil
opengraph
1.0.1
1.0.1.0lib to work with OpenGraph
MIT
The Development Requires
by Dmytro Sokil
opengraph
Wallogit.com
2017 © Pedro Peláez
lib to work with OpenGraph
Lib to render open graph., (*2)
composer require sokil/php-social-opengraph
// Open Graph
$openGraph = new \Sokil\OpenGraph;
$openGraph
->setTitle('The Matrix Revolutions')
->setDescription('The human city of Zion ...')
->setType(\Sokil\OpenGraph::TYPE_PRODUCTS_MOVIE)
->setImage('https://server.com/Matrix_Revolutions_poster.jpg')
->setUrl('http://www.imdb.com/title/tt0242653/')
->setVideoUrl('https://server.com/3453245.torrent')
->setVideoType('application/x-bittorrent');
Then you can get opengraph as array. This may be useful to render meta tags in frameworks. Example for Yii:, (*3)
$cs = Yii::app()->getClientScript();
foreach($openGraph->toArray() as $property => $content) {
$cs->registerMetaTag($content, null, null, array(
'property' => $property,
));
}
You can render meta tags directly:, (*4)
echo $openGraph->render(); // or just: echo $openGraph;
lib to work with OpenGraph
MIT
opengraph
lib to work with OpenGraph
MIT
opengraph