myckhel/laravel-iaphub
最新稳定版本:v0.2.1
Composer 安装命令:
composer require myckhel/laravel-iaphub
包简介
IAPHUB APIs in laravel
关键字:
README 文档
README
Iaphub Doc Link
Install
Via Composer
composer require myckhel/laravel-iaphub
Setup
The 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
Available Api's
<?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);
API Usage Example
<?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()); } }
Middleware
IAPHUB provided 2 middlewares
iaphub_hook_token
For authenticating iaphub hook request
Example:
<?php Route::any('iaphub/hooks', [SubscriptionController::class, 'hooks'])->middleware('iaphub_hook_token');
iaphub_disabled
For disabling route request returns 403 response
Example:
<?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", } */
Todos
- coming soon
Testing
Run the tests with:
vendor/bin/phpunit
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
Security
If you discover any security-related issues, please email myckhel1@hotmail.com instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 1.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-15