henryejemuta/laravel-megasubplug
Composer 安装命令:
composer require henryejemuta/laravel-megasubplug
包简介
A laravel package to seamlessly integrate MegaSup Plug API into your laravel application. The MegaSup Plug API allows you to integrate all virtual top-up and bills payment services available on the MegaSup platform with your application (websites, desktop apps & mobile apps). You can also start your
关键字:
README 文档
README
What is MegaSubPlug
The MegaSubPlug API allows you to integrate all virtual top-up and bills payment services available on the MegaSubPlug platform with your application (websites, desktop apps & mobile apps). You can also start your own VTU business by integrating this API and resell MegaSubPlug services in Nigeria.
What is Laravel MegaSubPlug
Laravel MegaSubPlug is a laravel package to seamlessly integrate MegaSubPlug api within your laravel application.
Create a MegaSubPlug Account Sign Up.
Look up MegaSubPlug API Documentation API Documentation. The Updated Mega-Sub Api Documentation is now part of the repository, as there seems to be broken links finding it on their dashboard
Installation
You can install the package via composer:
composer require henryejemuta/laravel-megasubplug
Publish MegaSubPlug configuration file, migrations as well as set default details in .env file:
php artisan megasubplug:init
Usage
Important: Kindly use the $response->successful() to check the response state before proceeding with working with the response and gracefully throw and handle the MegaSubPlugErrorException on failed request
Before initiating any transaction kindly check your balance to confirm you have enough MegaSubPlug balance to handle the transaction
The Laravel MegaSubPlug Package is quite easy to use via the MegaSubPlug facade
use HenryEjemuta\LaravelMegaSubPlug\Facades\MegaSubPlug; use HenryEjemuta\LaravelMegaSubPlug\Classes\MegaSubPlugResponse; ... //To buy Airtime try{ $response = MegaSubPlugFacade::buyAirtime(NetworkEnum::getNetwork('mtn'), 100, '08134567890'); } catch (MegaSubPlugErrorException $exception) { Log::error($exception->getMessage() . "\n\r" . $exception->getCode()); } //A dump of the MegaSubPlugResponse on successful airtime purchase HenryEjemuta\LaravelMegaSubPlug\Classes\MegaSubPlugResponse {#1423 ▼ -message: "" -hasError: false -error: null -code: 200 -body: {#1539 ▼ +"id": 167630 +"airtime_type": "VTU" +"network": 1 +"paid_amount": "97.0" +"mobile_number": "08134567890" +"amount": "100" +"plan_amount": "₦100" +"plan_network": "MTN" +"balance_before": "2892.6" +"balance_after": "2795.6" +"Status": "successful" +"create_date": "2021-08-28T21:02:54.311846" +"Ported_number": true } } //To buy Data Bundle try{ $response = MegaSubPlugFacade::buyData(MegaSubPlugNetworkEnum::getNetwork("mtn"), 7, "08134567890"); } catch (MegaSubPlugErrorException $exception) { Log::error($exception->getMessage() . "\n\r" . $exception->getCode()); } //A dump of the MegaSubPlugResponse on successful data purchase HenryEjemuta\LaravelMegaSubPlug\Classes\MegaSubPlugResponse {#1423 ▼ -message: "" -hasError: false -error: null -code: 200 -body: {#1539 ▼ +"id": 108602 +"network": 1 +"balance_before": "2698.6" +"balance_after": "2459.6" +"mobile_number": "08134567890" +"plan": 7 +"Status": "successful" +"plan_network": "MTN" +"plan_name": "1.0GB" +"plan_amount": "₦239.0" +"create_date": "2021-08-28T21:27:41.169631" +"Ported_number": true } } ...
Find an overview of all method with comment on what they do and expected arguments
/**
* Get Your MegaSub account details including available balance
* @return MegaSubPlugResponse
* @throws MegaSubPlugErrorException
*/
public function checkUserDetails(): MegaSubPlugResponse
/**
* @param NetworkEnum $mobileNetwork
* @param int $amount
* @param $phoneNumber
* @param bool $portedNumber
* @param string $airtimeType
* @return MegaSubPlugResponse
* @throws MegaSubPlugErrorException
*/
public function buyAirtime(NetworkEnum $mobileNetwork, int $amount, $phoneNumber, bool $portedNumber = true, string $airtimeType = "VTU"): MegaSubPlugResponse
/**
* MegaSubPlug API Transaction handler to access:
* Transaction()->getAllDataTransaction(): MegaSubPlugResponse
* Transaction()->queryDataTransaction(int $txnId): MegaSubPlugResponse
* Transaction()->queryAirtimeTransaction(int $txnId): MegaSubPlugResponse
* Transaction()->queryElectricityBillTransaction(int $txnId): MegaSubPlugResponse
* Transaction()->queryCableTvTransaction(int $txnId): MegaSubPlugResponse
*
* @return Transaction
*/
public function Transaction(): Transaction
/**
* Cable TV Bill handler to access:
* CableTv()->verifyIUC(CableTvEnum $cableTv, $smartCardNo): MegaSubPlugResponse
* CableTv()->purchasePackage(CableTvEnum $cableTv, string $package, $smartCardNo): MegaSubPlugResponse
*
* @return CableTv
*/
public function CableTv(): CableTv
/**
* @param NetworkEnum $network
* @param string $plan
* @param string $phoneNumber
* @param bool $portedNumber
* @return MegaSubPlugResponse
* @throws MegaSubPlugErrorException
*/
public function buyData(NetworkEnum $network, string $plan, string $phoneNumber, bool $portedNumber = true): MegaSubPlugResponse
/**
* Electricity Bills payment handler to access:
* Electricity()->verifyMeterNumber(DiscoEnum $disco, $meterNumber, MeterTypeEnum $meterType): MegaSubPlugResponse
* Electricity()->buyElectricity(DiscoEnum $disco, $meterNumber, $amount, MeterTypeEnum $meterType): MegaSubPlugResponse
*
* @return Electricity
*/
public function Electricity(): Electricity
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email henry.ejemuta@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.
henryejemuta/laravel-megasubplug 适用场景与选型建议
henryejemuta/laravel-megasubplug 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 05 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「airtime」 「Nigeria」 「data bundle」 「bill payment」 「Utility Bills」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 henryejemuta/laravel-megasubplug 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 henryejemuta/laravel-megasubplug 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 henryejemuta/laravel-megasubplug 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Library for interacting with Freepaid's SOAP interface for vending pre-paid Airtime Vouchers
RawPHP is currently the most powerful framework in the world because of its ability to combine only the good parts of raw PHP, Laravel, CakePHP and Slim frameworks. It is PHP framework that helps you quickly write simple yet powerful web applications and APIs. You can write both laravel, Slim and ca
Africa's Talking API package
A PHP library for communicating with the Reloadly API.
A funny and hopefully non-annoying way to pick random names for unregistered users or anonymize identities.
A laravel package to seamlessly integrate VTU.ng API into your laravel application. The VTU.ng API is an HTTPs GET API that allows you to integrate all virtual top-up and bills payment services available on our platform with your application (websites, desktop apps & mobile apps). You can also start
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-24