LaravelとGoogle APIの統合

LaravelでGoogleのAPIを利用します。
Laravelにはcomposerが内包されているため、簡単にGoogle APIを統合することができます。

Quick Start

laravelルートディレクトリのcomposer.jsonにpackageを記述。

// 略
    "require": {
        "laravel/framework": "4.2.*",
        "google/apiclient": "1.*"
    },
// 略

composer updateの実行

< composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)

// 略

Updating dependencies (including require-dev)
 - Installing google/apiclient (1.0.6-beta)
   Downloading: 100%

Generating autoload files
Generating optimized class loader

あとは使うだけです。

$client = new Google_Client();
$client->setClientId($clientId);

// 略
上部へスクロール