ozankurt/google-core

Laravel 5 Google Core

v2.0 2016-11-04 12:15 UTC

This package is auto-updated.

Last update: 2020-05-24 14:52:18 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

A package to keep all the required google setup together and ready.

Installation

Step 1

Add ozankurt/google-core to your composer requirements.

composer require ozankurt/google-core

Getting ready to use

Step 1

Create a google developer account which as actually logging in to any of your google accounts.

From https://developers.google.com/console/.

Step 2

Create a new project.

PS: Skip this step if you already have one.

Step 3

Create a new Service Account and download the json auth file.

PS: Skip this step if you already have one.

Create Credentials - 1 Create Credentials - 2

Step 5

Copy the json auth file somewhere be used in php.

Configuration (Pure PHP)

Example Configuration File

<?php

require 'vendor/autoload.php';

use Kurt\Google\Core;

$googleCore = new Core([
    'applicationName'       => 'Google API Wrapper Demo',
    'jsonFilePath'          => 'Google API Wrapper Demo-174e172143a9.json',
    'scopes' => [
        // 
    ],
]);

Configuration (Laravel)

Step 1

Add the service provider to you config/app.php.

'providers' => [
    Kurt\Google\CoreServiceProvider::class,
],

Step 2

Run vendor:publish command from your terminal.

php artisan vendor:publish

Step 3

Edit the fields in the configuration file.

<?php

return [

    /*
     * Application Name
     *
     * Name of your project in `https://console.developers.google.com/`.
     */
    'applicationName' => 'Google API Wrapper Demo',

    /*
     * Json Auth File Path
     *
     * After creating a project, go to `APIs & auth` and choose `Credentials` section.
     * 
     * Click `Create new Client ID` and select `Service Account` choose `P12` as the `Key Type`.
     *
     * After downloading the `p12` file copy and paste it in the `storage` directory.
     * 		Example:
     * 			storage/Google API Wrapper Demo-174e172143a9.json
     * 
     */
    'jsonFilePath' => storage_path('Google API Wrapper Demo-174e172143a9.json'),

    /*
     * Here you should pass an array of needed scopes depending on what service you will be using.
     *
     * 		Example:
     * 			For analytics service:
     * 			
     * 				'scopes' => [
     *					'https://www.googleapis.com/auth/analytics.readonly',
     *				],
     */
    'scopes' => [
        //
    ],

];

License

This open-sourced is software licensed under the MIT license.