PHP code example of vsavritsky / sonata-media-liip-imagine

1. Go to this page and download the library: Download vsavritsky/sonata-media-liip-imagine library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vsavritsky / sonata-media-liip-imagine example snippets



// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Enemis\SonataMediaLiipImagineBundle\SonataMediaLiipImagineBundle(),
        );

        // ...
    }

    // ...
}


#Application\Sonata\MediaBundle\Provider\YouTubeProvider

namespace Application\Sonata\MediaBundle\Provider;

use Enemis\SonataMediaLiipImagineBundle\Provider\YouTubeProvider as EnemisYoutubeProvider;

class YouTubeProvider extends EnemisYoutubeProvider
{
    /**
     * Get provider reference url.
     *
     * @param MediaInterface $media
     *
     * @return string
     */
    public function getReferenceUrl(MediaInterface $media)
    {
        return sprintf('https://www.youtube.com/watch?v=%s', $media->getProviderReference());
    }
}