Download the PHP package tenolo/open-graph-bundle without Composer
On this page you can find all versions of the php package tenolo/open-graph-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package open-graph-bundle
OpenGraphBundle
The TenoloOpenGraphBundle is a simple way to improve how you manage OpenGraph into your Symfony2 application.
Note: OpenGraph is a standard protocol used by many websites (Facebook, Twitter, Google, ...) to obtain more precise informations about your content.
The idea of this bundle it to associate each entity of your app with an OpenGraph map, a service able to create the OpenGraph document for your entity.
It also works with any other type of data.
Installation
Installation is very quick:
1. Download it with Composer
Add the bundle to your composer.json
file by running:
composer require tenolo/open-graph-bundle
2. Enable it in your kernel
Enable the bundle in your app/AppKernel.php
file;
Usage
The TenoloOpenGraphBundle will associate:
- Entities of your application with ...
- ... or Other Data like an array of your application with ...
- OpenGrap maps, definitions of these entities in an OpenGraph way
Let's take an example for a better understanding: a blog post.
Your entity
For a blog post, you could have an entity like this one:
Its OpenGraph map
The map associated with your entity will be a class implementing
Tenolo\Bundle\OpenGraphBundle\Map\OpenGraphMapInterface
and the two required methods of this interface :
map(DocumentWriterInterface $document, $data)
and supports($data)
.
For instance, our map could look like this :
The supports
method declares with what kind of entities this map is able to deal.
The map
method create an OpenGraph document representing the given entity.
Once created, we still have to register our class into the OpenGraph manager. To do so,
we will have to use the tag tenolo_open_graph.map
:
Using the map
Our map is registered, so we can use it anywhere we want to render it. For instance, with Twig:
Note: if no map is able to deal with the entity given in
opengraph_render
, anNotSupported
exception will be thrown.Another Note: Credits and inspiration goes to tgalopin
just saying ;)
All versions of open-graph-bundle with dependencies
symfony/framework-bundle Version ~2.8|~3.4|~4.0
symfony/config Version ~2.8|~3.4|~4.0
symfony/http-kernel Version ~2.8|~3.4|~4.0
symfony/dependency-injection Version ~2.8|~3.4|~4.0
symfony/twig-bundle Version ~2.8|~3.4|~4.0
twig/twig Version ~1.34|~2.0
euskadi31/opengraph Version ~1.0