lloricode/laravel-maya-sdk
Composer 安装命令:
composer require lloricode/laravel-maya-sdk
包简介
SDK for Paymaya using Laravel
关键字:
README 文档
README
Maya SDK for laravel, it uses lloricode/paymaya-sdk-php.
Installation
You can install the package via composer:
composer require lloricode/laravel-maya-sdk
You can publish the config file with:
php artisan vendor:publish --provider="Lloricode\LaravelPaymaya\LaravelPaymayaServiceProvider" --tag="maya-sdk-config"
This is the contents of the published config file:
<?php declare(strict_types=1); use Lloricode\Paymaya\Enums\Environment; use Lloricode\Paymaya\Enums\Webhook; /** * @todo: Manage Exception using laravel logs, allow set config log files */ return [ 'mode' => env('MAYA_MODE', Environment::Sandbox->value), 'keys' => [ 'public' => env('MAYA_PUBLIC_KEY'), 'secret' => env('MAYA_SECRET_KEY'), ], /** * Webhooks */ 'webhooks' => [ Webhook::CHECKOUT_SUCCESS => 'api/payment-callback/maya/success', Webhook::CHECKOUT_FAILURE => 'api/payment-callback/maya/failure', Webhook::CHECKOUT_DROPOUT => 'api/payment-callback/maya/dropout', // Webhook::PAYMENT_SUCCESS => 'api/test/success', // Webhook::PAYMENT_EXPIRED => 'api/test/expired', // Webhook::PAYMENT_FAILED => 'api/test/failed', ], 'checkout' => [ 'customization' => [ 'logoUrl' => 'https://image1.png', 'iconUrl' => 'https://image2.png', 'appleTouchIconUrl' => 'https://image3.png', 'customTitle' => 'test maya sandbox title', 'colorScheme' => '#e01c44', 'redirectTimer' => 3, // 'hideReceiptInput' => true, // 'skipResultPage' => false, // 'showMerchantName' => true, ], ], ];
Usage
You can copy the sample to test it.
Checkout
https://developers.maya.ph/reference/createv1checkout
use Lloricode\LaravelPaymaya\Facades\PaymayaFacade; use Lloricode\Paymaya\DataTransferObjects\Checkout\Amount\AmountDetailDto; use Lloricode\Paymaya\DataTransferObjects\Checkout\Amount\AmountDto; use Lloricode\Paymaya\DataTransferObjects\Checkout\Buyer\BillingAddressDto; use Lloricode\Paymaya\DataTransferObjects\Checkout\Buyer\BuyerDto; use Lloricode\Paymaya\DataTransferObjects\Checkout\Buyer\ContactDto; use Lloricode\Paymaya\DataTransferObjects\Checkout\Buyer\ShippingAddressDto; use Lloricode\Paymaya\DataTransferObjects\Checkout\CheckoutDto; use Lloricode\Paymaya\DataTransferObjects\Checkout\ItemDto; use Lloricode\Paymaya\DataTransferObjects\Checkout\MetaDataDto; use Lloricode\Paymaya\DataTransferObjects\Checkout\RedirectUrlDto; use Lloricode\Paymaya\DataTransferObjects\Checkout\TotalAmountDto; $checkout = new CheckoutDto( totalAmount: new TotalAmountDto( value: 100, details: new AmountDetailDto( subtotal: 100 ) ), buyer: new BuyerDto( firstName: 'John', middleName: 'Paul', lastName: 'Doe', birthday: '1995-10-24', customerSince: '1995-10-24', gender: 'M', contact: new ContactDto( phone: '+639181008888', email: 'merchant@merchantsite.com' ), shippingAddress: new ShippingAddressDto( firstName: 'John', middleName: 'Paul', lastName: 'Doe', phone: '+639181008888', email: 'merchant@merchantsite.com', line1: '6F Launchpad', line2: 'Reliance Street', city: 'Mandaluyong City', state: 'Metro Manila', zipCode: '1552', countryCode: 'PH', shippingType: 'ST' ), billingAddress: new BillingAddressDto( line1: '6F Launchpad', line2: 'Reliance Street', city: 'Mandaluyong City', state: 'Metro Manila', zipCode: '1552', countryCode: 'PH' ) ), items: [ new ItemDto( name: 'Canvas Slip Ons', quantity: 1, code: 'CVG-096732', description: 'Shoes', amount: new AmountDto( value: 100, details: new AmountDetailDto( discount: 0, serviceCharge: 0, shippingFee: 0, tax: 0, subtotal: 100 ) ), totalAmount: new AmountDto( value: 100, details: new AmountDetailDto( discount: 0, serviceCharge: 0, shippingFee: 0, tax: 0, subtotal: 100 ) ) ), ], redirectUrl: new RedirectUrlDto( success: 'https://www.merchantsite.com/success', failure: 'https://www.merchantsite.com/failure', cancel: 'https://www.merchantsite.com/cancel' ), requestReferenceNumber: '1551191039', metadata: new MetaDataDto( smi: 'smi', smn: 'smn', mci: 'mci', mpc: 'mpc', mco: 'mco', mst: 'mst' ) ); // submit $checkoutResponse = PaymayaFacade::createCheckout($checkout); echo 'id: '.$checkoutResponse->checkoutId."\n"; echo 'url: '.$checkoutResponse->redirectUrl."\n"; // retrieve PaymayaFacade::getCheckout($checkoutResponse->checkoutId);
Webhook
https://developers.maya.ph/reference/createv1webhook-1
# see config `maya.webhooks` array to set your webhooks,
# then run this to create webhooks.
php artisan maya:webhook:create
# get all webhooks
php artisan maya:webhook:all
# retrieve output
+--------+------------------+------------------------------+---------------------+---------------------+
| id | name | callbackUrl | createdAt | updatedAt |
+--------+------------------+------------------------------+---------------------+---------------------+
| <uuid> | CHECKOUT_SUCCESS | http://localhost/api/success | 2021-02-05 17:40:40 | 2021-02-05 17:40:40 |
| <uuid> | CHECKOUT_FAILURE | http://localhost/api/failed | 2021-02-05 17:40:45 | 2021-02-05 17:40:45 |
| <uuid> | CHECKOUT_DROPOUT | http://localhost/api/dropout | 2021-02-05 17:40:45 | 2021-02-05 17:40:45 |
+--------+------------------+------------------------------+---------------------+---------------------+
Testing with Saloon Client Mock
Sample usage of client mock https://docs.saloon.dev/the-basics/testing
use Lloricode\Paymaya\Requests\Checkout\CreateCheckoutRequest;
use Saloon\Http\Faking\MockClient;
use Saloon\Http\Faking\MockResponse;
/**
* @test
*/
public function success_checkout()
{
$paymayaID = 'test-maya-generated-id';
$paymayaRedirectUrl = 'http://test-maya/redirect-url';
MockClient::global([
CreateCheckoutRequest::class => new MockResponse(
body: [
'checkoutId' => $paymayaID,
'redirectUrl' => $paymayaRedirectUrl,
]
),
]);
// your test
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
lloricode/laravel-maya-sdk 适用场景与选型建议
lloricode/laravel-maya-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 229 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「sdk」 「laravel」 「paymaya」 「lloricode」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lloricode/laravel-maya-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lloricode/laravel-maya-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lloricode/laravel-maya-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Alfabank REST API integration
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
Laravel package for Accurate Online API integration.
A lightweight plain-PHP framework for database-backed CRUD APIs.
bughq error tracking - PHP SDK
Shared RCX Laravel DataTables UI and configuration helpers.
统计信息
- 总下载量: 229
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-01