Via Composer
composer require myckhel/laravel-iaphubThe package will automatically register a service provider.
You need to publish the configuration file:
php artisan vendor:publish --provider="Myckhel\Iaphub\IaphubServiceProvider"This is the default content of the config file iaphub.php:
<?php
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'
];Update Your Projects .env with:
IAPHUB_API_KEY=XXXXXXXXXXXXXXXXX
IAPHUB_APP_ID=XXXXXXXXXXXXXXXXX
IAPHUB_HOOK_TOKEN=XXXXXXXXXXXXXXXXX
IAPHUB_APP_ENV=development
Run the database migration
php artisan migrate<?php
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);<?php
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());
}
}IAPHUB provided 2 middlewares
For authenticating iaphub hook request
<?php
Route::any('iaphub/hooks', [SubscriptionController::class, 'hooks'])->middleware('iaphub_hook_token');For disabling route request returns 403 response
<?php
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",
}
*/- coming soon
Run the tests with:
vendor/bin/phpunitPlease see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security-related issues, please email myckhel1@hotmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.