-
Notifications
You must be signed in to change notification settings - Fork 158
started with laravel 5
Jason Leung edited this page Sep 21, 2015
·
8 revisions
Add this package to composer.json
and run composer update if you haven't already done do.
composer -vvv update
Go to /config/app.php
, In providers
, add:
Madcoda\Youtube\YoutubeServiceProviderLaravel5::class,
In aliases
, add:
'Youtube' => Madcoda\Youtube\Facades\Youtube::class,
In the command line, please run
php artisan vendor:publish
In your /config/youtube.php
, you should fill in your api key
<?php
return array(
/*
* You can set the API Key here
*/
'key' => 'ABCDEFGHIJKLMNOPQabcdefghijklmnopq'
);
To Verify it's working, feel free to create a controller and map to a route, here is a simple controller example
In app/Http/routes.php
Route::get('/', 'YoutubeController@index');
In app/Http/Controllers/YoutubeController.php
namespace App\Http\Controllers;
class YoutubeController extends Controller {
public function index()
{
dd(Youtube::getVideoInfo(Input::get('vid', 'dQw4w9WgXcQ')));
}
}