2017 © Pedro Peláez
 

library illuminate-google

Provides Google API Library for PHP wrapper for Laravel/Lumen

image

mingalevme/illuminate-google

Provides Google API Library for PHP wrapper for Laravel/Lumen

  • Friday, October 6, 2017
  • by mingalevme
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 75 % Grown

The README.md

illuminate-google

Provides Google API Library for PHP wrapper for Laravel/Lumen, (*1)

Installation

  1. composer require mingalevme/illuminate-google., (*2)

  2. Register the service provider Mingalevme\Illuminate\Google\GoogleServiceProvider., (*3)

  3. (Optionally) Add alias to your bootstrap file:, (*4)

'Google' => Mingalevme\Illuminate\Google\Facades\Google::class,
  1. (Optionally) For Laravel run
php artisan vendor:publish --provider="Mingalevme\Illuminate\Google\GoogleServiceProvider" --tag="config"

to publish the config file., (*5)

  1. (Optionally) For Lumen copy /vendor/mingalevme/illuminate-google/config/google.php to /config/google.php., (*6)

  2. Instead of 4 and/or 5 if you plan to use just one Google Analytics (most common case), place JWT-file to /resources/google-service-account-key.json, if the service is not Google Analytics, setup one in your .env:, (*7)

GOOGLE_SERVICE=Google_Service_AndroidPublisher
GOOGLE_SCOPE=https://www.googleapis.com/auth/androidpublisher
  1. Now you are able to use the library:
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Mingalevme\Illuminate\Google\Facades\Google;

class MyController extends Controller
{
    public function publisher(Request $request)
    {
        /* @var $publisher \Google_Service_AndroidPublisher */
        $publisher = Google::service();

        /* @var $purchase \Google_Service_AndroidPublisher_SubscriptionPurchase */
        try {
            $purchaseData = (array) $publisher->purchases_subscriptions
                    ->get($request->input('app_id'), $request->input('product_id'), $request->input('purchase_token'))
                    ->toSimpleObject();
        } catch (\Google_Service_Exception $e) {
            $purchaseData = ['errors' => $e->getErrors()];
        }

        return response()->json($purchaseData, isset($e) ? $e->getCode() : 200);
    }

    public function analytics(Request $request)
    {
        /* @var $analytics \Google_Service_Analytics */
        $analytics = Google::service('analytics');
        ...
    }

}

The Versions

06/10 2017

dev-master

9999999-dev https://github.com/mingalevme/illuminate-google

Provides Google API Library for PHP wrapper for Laravel/Lumen

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel lumen google google-api

06/10 2017

1.0.0

1.0.0.0 https://github.com/mingalevme/illuminate-google

Provides Google API Library for PHP wrapper for Laravel/Lumen

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel lumen google google-api