2017 © Pedro Peláez
 

symfony-bundle kayue-essence-bundle

This bundle integrates the Essence library (an oEmbed library) into Symfony 2.

image

kayue/kayue-essence-bundle

This bundle integrates the Essence library (an oEmbed library) into Symfony 2.

  • Tuesday, October 15, 2013
  • by kayue
  • Repository
  • 1 Watchers
  • 6 Stars
  • 14,853 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

KayueEssenceBundle

This bundle integrates the Essence library (an oEmbed library) into Symfony 2., (*1)

Installation

Composer

Add the bundle to composer.json, (*2)

{
    "require": {
        "kayue/kayue-essence-bundle": "dev-master"
    }
}

Update Composer dependency:, (*3)

composer update kayue/kayue-essence-bundle

Register the bundle

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Kayue\EssenceBundle\KayueEssenceBundle(),
    );
    // ...
}

Configuration

No configuration is required. However you should change the cache driver to apc if your server support it. Default cache driver is array, (*4)

kayue_essence:
    cache_driver: apc

Usage

Service

<?php

class WelcomeController extends Controller
{
    public function indexAction()
    {
        $essence = $this->get('kayue_essence');
        $media = $essence->embed('http://www.youtube.com/watch?v=39e3KYAmXK4');
        $media->title; // return the video title "Bill Hicks - Revelations (1993)"
    }
}

Twig Extension

Replace Filter

Essence can replace any embeddable URL in a text by informations about it., (*5)

{{ 'Some random text plus http://www.youtube.com/watch?v=39e3KYAmXK4'|essence_replace }}
Embed Function

You can retrieve video informations in just one line., (*6)

{{ essence_embed('http://www.youtube.com/watch?v=39e3KYAmXK4').html }}

With max width:, (*7)

{{ essence_embed('http://www.youtube.com/watch?v=39e3KYAmXK4', {'maxwidth': 100}).html }}

The Versions

15/10 2013

dev-master

9999999-dev http://github.com/kayue/KayueEssenceBundle

This bundle integrates the Essence library (an oEmbed library) into Symfony 2.

  Sources   Download

MIT

The Requires

 

symfony2 symfony media youtube oembed vimeo