2017 © Pedro Peláez
 

library lara5-googleclient-api

Google api php client wrapper with Cloud Platform and Laravel 4 & 5 support

image

irisdande/lara5-googleclient-api

Google api php client wrapper with Cloud Platform and Laravel 4 & 5 support

  • Tuesday, July 19, 2016
  • by IrisDande
  • Repository
  • 1 Watchers
  • 1 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Google Api Client Wrapper

Google api php client wrapper with Cloud Platform and Laravel 4 & 5 support, (*1)

Build Status Scrutinizer Code Quality Coverage Status License Latest Version Total Downloads, (*2)

Requirements

This package requires PHP >=5.4, (*3)

Installation

Install via composer - edit your composer.json to require the package., (*4)

"require": {
    "irisdande/lara5-googleclient-api": "2.*"
}

Then run composer update in your terminal to pull it in., (*5)

Or use composer require irisdande/lara5-googleclient-api, (*6)

Laravel

To use in laravel add the following to the providers array in your config/app.php, (*7)

IrisDande\Google\GoogleServiceProvider::class

Next add the following to the aliases array in your config/app.php, (*8)

'Google' => IrisDande\Google\Facades\Google::class

Finally run php artisan vendor:publish --provider="IrisDande\Google\GoogleServiceProvider" --tag="config" to publish the config file., (*9)

Looking for a Laravel 4 compatible version?

Checkout the 1.0 branch, (*10)

Usage

The Client class takes an array as the first parameter, see example of config file below:, (*11)

return [
    /*
    |----------------------------------------------------------------------------
    | Google application name
    |----------------------------------------------------------------------------
    */
    'application_name' => '',

    /*
    |----------------------------------------------------------------------------
    | Google OAuth 2.0 access
    |----------------------------------------------------------------------------
    |
    | Keys for OAuth 2.0 access, see the API console at
    | https://developers.google.com/console
    |
    */
    'client_id' => '',
    'client_secret' => '',
    'redirect_uri' => '',
    'scopes' => [],
    'access_type' => 'online',
    'approval_prompt' => 'auto',

    /*
    |----------------------------------------------------------------------------
    | Google developer key
    |----------------------------------------------------------------------------
    |
    | Simple API access key, also from the API console. Ensure you get
    | a Server key, and not a Browser key.
    |
    */
    'developer_key' => '',

    /*
    |----------------------------------------------------------------------------
    | Google service account
    |----------------------------------------------------------------------------
    |
    | Set the information below to use assert credentials
    | Leave blank to use app engine or compute engine.
    |
    */
    'service' => [
        /*
        | Example xxx@developer.gserviceaccount.com
        */
        'account' => '',

        /*
        | Example ['https://www.googleapis.com/auth/cloud-platform']
        */
        'scopes' => [],

        /*
        | Path to key file
        | Example storage_path().'/key/google.p12'
        */
        'key' => '',
    ]
];

To use the Google Cloud Platform Services you can either set the information in the config file under service, or if running under compute engine (or app engine) leave it blank., (*12)

NOTE: service => ['account'] is the service Email Address and not the Client ID!, (*13)

Get Google_Client, (*14)

$client = new IrisDande\Google\Client($config);
$googleClient = $client->getClient();

Laravel Example:, (*15)

$googleClient = Google::getClient();

Get a service, (*16)

$client = new IrisDande\Google\Client($config);

// returns instance of \Google_Service_Storage
$storage = $client->make('storage');

// list buckets example
$storage->buckets->listBuckets('project id');

// get object example
$storage->objects->get('bucket', 'object');

The Versions

19/07 2016

dev-master

9999999-dev https://github.com/IrisDande/lara5-googleclient-api

Google api php client wrapper with Cloud Platform and Laravel 4 & 5 support

  Sources   Download

MIT

The Requires

 

The Development Requires

by Antonio Nguyen

laravel google cloud platform