Skip to content

started with laravel 4

Jason Leung edited this page Sep 4, 2015 · 4 revisions

Getting started with Laravel 4 project

Install

Add this package to composer.json and run composer update if you haven't already done do.

composer -vvv update

Go to app/config/app.php, In providers, add:

'Madcoda\Youtube\YoutubeServiceProviderLaravel4',

In aliases, add:

'Youtube' => 'Madcoda\Youtube\Facades\Youtube',

Config

In the command line, please run

php artisan config:publish madcoda/php-youtube-api

In your app/config/packages/madcoda/php-youtube-api/youtube.php, you should fill in your api key

<?php

return array(

	/*
	 *  You can set the API Key here
	 */

	'key' => 'ABCDEFGHIJKLMNOPQabcdefghijklmnopq'

);

Test it out

To Verify it's working, feel free to create a controller and map to a route, here is a simple controller example

routes.php

Route::get('/', 'YoutubeController@index');

YoutubeController.php

class YoutubeController extends BaseController {

    public function index()
    {
        dd(Youtube::getVideoInfo(Input::get('vid', 'dQw4w9WgXcQ')));
    }

}