PHP code example of myckhel / laravel-iaphub

1. Go to this page and download the library: Download myckhel/laravel-iaphub 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/ */

    

myckhel / laravel-iaphub example snippets



  return [
    "api_key"          => env("IAPHUB_API_KEY"),
    "app_id"           => env("IAPHUB_APP_ID"),
    "env"              => env("IAPHUB_APP_ENV"),
    "hook_token"       => env("IAPHUB_HOOK_TOKEN"),
    // this middleware will be used for IAPHUB routes
    "route_middleware" => 'iaphub_disabled', // comma separated values e.g 'auth:api,auth:web'
  ];


use Iaphub;

Iaphub::getUser($userId, $params);
Iaphub::postUser($userId, $params);
Iaphub::postUserPricing($userId, $params);
Iaphub::postUserReceipt($userId, $params);
Iaphub::postUserPurchases($userId, $params);
Iaphub::getPurchase($purchaseId, $params);
Iaphub::getReceipt($receiptId, $params);



namespace Myckhel\Iaphub\Http\Controllers;

use Illuminate\Routing\Controller;
use Myckhel\Iaphub\Http\Requests\IaphubRequest;
use Illuminate\Http\Request;
use Iaphub;

class IaphubController extends Controller
{
  public function getUser(IaphubRequest $request, $id){
    return Iaphub::getUser($id, $request->all());
  }
}


Route::any('iaphub/hooks',  [SubscriptionController::class, 'hooks'])->middleware('iaphub_hook_token');



Route::any('iaphub/hooks',  [SubscriptionController::class, 'hooks'])->middleware('iaphub_disabled');
/* returns {
    "message": "This Endpoint Is Disabled \n enable it by replacing the 'iaphub_disabled' middleware from your config",
  }
*/

bash
php artisan vendor:publish --provider="Myckhel\Iaphub\IaphubServiceProvider"
iaphub.php
bash
php artisan migrate