PHP code example of mingalevme / illuminate-google

1. Go to this page and download the library: Download mingalevme/illuminate-google library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mingalevme / illuminate-google example snippets


'Google' => Mingalevme\Illuminate\Google\Facades\Google::class,

php artisan vendor:publish --provider="Mingalevme\Illuminate\Google\GoogleServiceProvider" --tag="config"



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');
        ...
    }
    
}
/vendor/mingalevme/illuminate-google/config/google.php
/config/google.php