This bundle integrates the OpenGraph library into Symfony.
## Installation
Simply run assuming you have installed composer :
$ php composer.phar require novaway/open-graph-bundle "^1.0"
## Configuration
Register the bundle in app/AppKernel.php
:
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new \Novaway\Bundle\OpenGraphBundle\NovawayOpenGraphBundle(),
);
}
See all available configuration options.
Just use annotation like it is explain in OpenGraph library documentation.
To use YAML graph configuration. You need to register your YAML file configuration in the Resources/config/open-graph
directory of your bundle.
After that, you can use YAML configuration like it is explain in OpenGraph library documentation.
The OpenGraphGenerator
is available as novaway.open_graph.generator
service :
// $myObject = ...
$graphGenerator = $this->get('novaway.open_graph.generator')->generate($myObject);
## Render OpenGraph in templates
The bundle comes with some Twig functions to render the graph into you templates.
renderNamespace
: Render graph prefix attributes (namespaces)renderGraph
: Render tags for the graphrenderTag
: Render a specific tag of the graph