2017 © Pedro Peláez
 

library php-social-opengraph

lib to work with OpenGraph

image

sokil/php-social-opengraph

lib to work with OpenGraph

  • Wednesday, June 13, 2018
  • by sokil
  • Repository
  • 2 Watchers
  • 1 Stars
  • 17 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 31 % Grown

The README.md

php-opengraph

Total Downloads Build Status, (*1)

Lib to render open graph., (*2)

Installation

composer require sokil/php-social-opengraph

Basic Usage

// 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;

The Versions

13/06 2018

dev-master

9999999-dev

lib to work with OpenGraph

  Sources   Download

MIT

The Development Requires

by Dmytro Sokil

opengraph

13/06 2018

1.0.1

1.0.1.0

lib to work with OpenGraph

  Sources   Download

MIT

The Development Requires

by Dmytro Sokil

opengraph

18/10 2015

1.0

1.0.0.0

lib to work with OpenGraph

  Sources   Download

MIT

by Dmytro Sokil