Skip to content

model behavior youtubeable

Harmen Janssen edited this page Apr 20, 2016 · 4 revisions

YouTubeable

Allows admins to insert just a YouTube URL in the CMS and the record will be automatically filled with YouTube metadata.

For best results, just include the Video.json config in the garp folder. It has all the configuration you need.

Migrating from YouTube API v2 to v3

Google has deprecated version 2 of the API. V3 is not supported by Zend Framework, so as of May 2015 this behavior has been refactored to use Google's own PHP library.

What do you need to do to make this work?

  1. Update Garp.
  2. Add to your composer.json:
"require": {
  "google/apiclient": "1.0.*@beta"
}

Note: no longer required if Garp is a requirement in your project
(make sure the vendor folder is not ignored in .gitignore!)

  1. Run composer install to grab the library
  2. Make sure Composer's autoload is included. Usually right above the inclusion of init.php in index.php:
require_once('../vendor/autoload.php');
require_once("../garp/application/init.php");
  1. Get an API key from Google. Make sure to register for a Server key, since it will be used on the server.
  2. Add the API key to app.ini:
google.apiKey = "<your-key-here>"

Done!

Clone this wiki locally