hopekelldev/laravel-klasha
Composer 安装命令:
composer require hopekelldev/laravel-klasha
包简介
Laravel SDK for Klasha Payments API
README 文档
README
A modern Laravel SDK for integrating with the Klasha Payments API.
Accept payments, create virtual accounts, manage transfers, verify transactions, fund wallets, and access Klasha financial services directly from your Laravel applications.
Laravel Klasha is a modern Laravel SDK that provides a clean and fluent interface for interacting with the Klasha API.
Accept payments, create virtual accounts, manage transfers, verify transactions, fund wallets, retrieve exchange rates, and access Klasha services directly from your Laravel applications.
Features
- Laravel Auto Discovery
- Facade Support
- Service Container Binding
- Fluent API Interface
- Virtual Accounts
- Payments
- Transfers
- Wallet Funding
- Transaction Verification
- Customer Payments
- Mobile Money
- Exchange Rates
- Bank Listings
- Country Listings
- Currency Listings
- Laravel 11, 12 & 13 Support
Requirements
| Requirement | Version |
|---|---|
| PHP | 8.2+ |
| Laravel | 11+ |
Installation
Install via Composer:
composer require hopekelldev/laravel-klasha
Publish Configuration
php artisan vendor:publish --tag=klasha-config
This publishes:
config/klasha.php
Environment Configuration
Add the following values to your .env file:
KLASHA_PUBLIC_KEY= KLASHA_SECRET_KEY= KLASHA_ENCRYPTION_KEY= KLASHA_BASE_URL=https://api.klasha.com
Configuration
return [ 'public_key' => env('KLASHA_PUBLIC_KEY'), 'secret_key' => env('KLASHA_SECRET_KEY'), 'encryption_key' => env('KLASHA_ENCRYPTION_KEY'), 'base_url' => env( 'KLASHA_BASE_URL', 'https://api.klasha.com' ), ];
Quick Start
Using The Facade
use HopekellDev\Klasha\Facades\Klasha;
Example:
$response = Klasha::payments() ->transactions();
Dependency Injection
use HopekellDev\Klasha\KlashaManager; class PaymentController { public function index(KlashaManager $klasha) { return $klasha->payments() ->transactions(); } }
Available Services
Klasha::payments(); Klasha::transfers(); Klasha::bankAccounts(); Klasha::misc();
Payments API
Access payment services:
Klasha::payments();
Initialize Payment
Create a payment request.
$response = Klasha::payments() ->initialize([ 'amount' => 10000, 'currency' => 'NGN', 'email' => 'customer@example.com', 'tx_ref' => uniqid(), 'redirect_url' => route('payment.callback'), ]);
Verify Transaction
$response = Klasha::payments() ->verify('TRANSACTION_REFERENCE');
Fetch Transaction
$response = Klasha::payments() ->fetch('TRANSACTION_ID');
List Transactions
$response = Klasha::payments() ->transactions();
Refund Transaction
$response = Klasha::payments() ->refund([ 'transaction_id' => '123456' ]);
Wallet Funding
Generate card BINs for wallet funding.
$response = Klasha::payments() ->generateBin('BUSINESS_ID');
Mobile Money
Initiate mobile money payments.
$response = Klasha::payments() ->mobileMoney([ 'amount' => 500, 'currency' => 'GHS', 'phone_number' => '233XXXXXXXXX', 'network' => 'MTN' ]);
Transfers API
Access transfer services:
Klasha::transfers();
Create Transfer Recipient
$response = Klasha::transfers() ->createRecipient([ 'bank_code' => '058', 'account_number' => '0123456789', 'account_name' => 'John Doe' ]);
Initiate Transfer
$response = Klasha::transfers() ->initiate([ 'amount' => 10000, 'currency' => 'NGN', 'recipient_id' => 'RECIPIENT_ID', 'reference' => uniqid() ]);
Verify Transfer
$response = Klasha::transfers() ->verify('TRANSFER_REFERENCE');
Fetch Transfer
$response = Klasha::transfers() ->fetch('TRANSFER_ID');
List Transfers
$response = Klasha::transfers() ->all();
Virtual Accounts API
Access virtual account services:
Klasha::bankAccounts();
Create Virtual Account
Klasha requires encrypted payloads.
$response = Klasha::bankAccounts() ->createVirtualAccount([ 'first_name' => 'John', 'last_name' => 'Doe', 'email' => 'john@example.com', 'currency' => 'NGN' ]);
Get Virtual Account
$response = Klasha::bankAccounts() ->getVirtualAccount('ACCOUNT_ID');
List Virtual Accounts
$response = Klasha::bankAccounts() ->virtualAccounts();
Disable Virtual Account
$response = Klasha::bankAccounts() ->disableVirtualAccount('ACCOUNT_ID');
Utility APIs
Access miscellaneous Klasha services.
Klasha::misc();
Banks
Retrieve supported banks.
$response = Klasha::misc() ->banks();
Countries
Retrieve supported countries.
$response = Klasha::misc() ->countries();
Currencies
Retrieve supported currencies.
$response = Klasha::misc() ->currencies();
Exchange Rates
$response = Klasha::misc() ->exchangeRate([ 'source_currency' => 'USD', 'destination_currency' => 'NGN', 'amount' => 100 ]);
Health Check
$response = Klasha::misc() ->health();
Response Format
Successful response:
[
'success' => true,
'message' => 'Request successful',
'data' => [
//
],
]
Error response:
[
'success' => false,
'message' => 'Invalid API Key',
'data' => null,
]
Error Handling
try { $response = Klasha::payments() ->initialize($payload); } catch (\Throwable $exception) { report($exception); return response()->json([ 'message' => $exception->getMessage() ], 500); }
Service Container
Resolve the SDK from Laravel's service container:
app('klasha');
or
app( \HopekellDev\Klasha\KlashaManager::class );
Testing
Run tests:
composer test
Changelog
v1.0.0
- Initial Release
- Payments API
- Transfers API
- Virtual Accounts API
- Wallet Funding
- Utility APIs
- Laravel Auto Discovery
- Facade Support
Security
If you discover any security vulnerability, please send an email to:
hopekelltech@gmail.com
All security vulnerabilities will be addressed promptly.
Contributing
Contributions are welcome.
Fork Repository
git clone https://github.com/HopekellDev/laravel-klasha.git
Create Branch
git checkout -b feature/my-feature
Commit Changes
git commit -m "Add my feature"
Push Changes
git push origin feature/my-feature
Open Pull Request
Submit a pull request describing your changes.
License
MIT License
Copyright (c) 2026 HopekellDev
Author
HopekellDev
Website: https://www.hopekelltech.com
Email: hopekelltech@gmail.com
GitHub: https://github.com/HopekellDev
Packagist: https://packagist.org/packages/hopekelldev/laravel-klasha
Made with ❤️ for the Laravel Community.
hopekelldev/laravel-klasha 适用场景与选型建议
hopekelldev/laravel-klasha 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 06 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payments」 「laravel」 「wechat」 「alipay」 「africa」 「fintech」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hopekelldev/laravel-klasha 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hopekelldev/laravel-klasha 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hopekelldev/laravel-klasha 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
WeChat OAuth SDK
微信SDK
钉钉、企业微信、飞书 自定义群组机器人。支持链式语法创建发送消息。支持文本、Markdown、图片、文件、图文、卡片等消息。
Dealing with payments through the Egyptian payment gateway PayMob
The wechat extension for the Yii framework
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 51
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-10
