mingalevme/illuminate-google 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mingalevme/illuminate-google

Composer 安装命令:

composer require mingalevme/illuminate-google

包简介

Provides Google API Library for PHP wrapper for Laravel/Lumen

README 文档

README

Provides Google API Library for PHP wrapper for Laravel/Lumen

Installation

  1. composer require mingalevme/illuminate-google.

  2. Register the service provider Mingalevme\Illuminate\Google\GoogleServiceProvider.

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

'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.

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

  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:

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');
        ...
    }
    
}

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固