azozzalfiras/payment-gateway 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

azozzalfiras/payment-gateway

Composer 安装命令:

composer require azozzalfiras/payment-gateway

包简介

A unified PHP library for integrating with MENA payment gateways: MyFatoorah, Paylink, and EdfaPay

README 文档

README

PHP Version License Composer

A unified, extensible PHP Composer package for integrating with 18 payment gateways (Middle East + Iraq + Europe + International). Built with clean architecture, full API coverage, zero external dependencies, and enterprise-grade security.

Table of Contents

Supported Gateways


MyFatoorah

Paylink

EdfaPay

Tap

ClickPay

Tamara

Thawani

Fatora

Payzaty

Payzah

Stripe

PayPal

NeonPay

AsiaPay

ZainCash

Mollie

Redsys

GoCardless
Gateway Region Classes Key Features Authentication
MyFatoorah Middle East 5 Payments, Sessions, Invoices, Customers, Webhooks API Key (Bearer)
Paylink Middle East 5 Invoices, Digital Products, Reconciliation, Webhooks API ID + Secret Key
EdfaPay Middle East 6 Checkout, Embedded S2S, Apple Pay, Recurring, Refunds Client Key + Password
Tap Middle East 7 Charges, Authorize/Void, Refunds, Invoices, Customers, Tokens Secret Key (Bearer)
ClickPay Middle East 3 Hosted Page, Auth/Capture/Void/Refund, Tokenization Server Key
Tamara Middle East 4 BNPL Checkout, Order Authorize/Capture/Cancel, Refunds API Token (Bearer)
Thawani Middle East 4 Checkout Sessions, Payment Intents, Customer Management Secret + Publishable Key
Fatora Middle East 4 Checkout, Verify, Refunds, Recurring (Card Tokenization) API Key
Payzaty Middle East 3 Secure Checkout, Mada/VISA/MC/Apple Pay/STC Pay Account No + Secret Key
Payzah Middle East 3 Hosted Checkout, K-Net/VISA/MC/Apple Pay/Amex Private Key
NeonPay Middle East 3 Payments, Refunds, Webhooks (EBIK Key Auth) EBIK Key (Header)
AsiaPay Middle East 4 Orders, Refunds, JWT Auth, Webhooks App Key + Secret (JWT)
ZainCash Middle East 3 Transactions, JWT HS256 Auth, Webhooks Merchant ID + Secret (JWT)
Stripe International 6 Checkout Sessions, Charges, Customers, Refunds, Webhooks Secret Key (Bearer)
PayPal International 6 Orders, Captures, Authorizations, Refunds, OAuth 2.0 Client ID + Secret (OAuth)
Mollie Europe 5 Payments, Refunds, Customers, iDEAL, SEPA, Klarna API Key (Bearer)
Redsys Europe 3 Payments, Refunds, 3DES + HMAC-SHA256 Signing Merchant Key (3DES)
GoCardless Europe 5 Payments, Mandates, Refunds, Direct Debit, Webhooks Access Token (Bearer)

79 PHP classes across 18 gateways organized in 3 regions: International/, MiddleEast/, Europe/

Installation

composer require azozzalfiras/payment-gateway
Requirement Version
PHP >= 8.1
ext-curl Required
ext-json Required
ext-mbstring Required

Quick Start

use AzozzALFiras\PaymentGateway\PaymentGateway;
use AzozzALFiras\PaymentGateway\Enums\Gateway;
use AzozzALFiras\PaymentGateway\Enums\PaymentStatus;
use AzozzALFiras\PaymentGateway\DTOs\PaymentRequest;
use AzozzALFiras\PaymentGateway\DTOs\Customer;

// Create gateway from enum
$gateway = PaymentGateway::create(Gateway::TAP->value, [
    'secret_key' => 'sk_test_xxx',
    'testMode'   => true,
]);

// Or use typed static factory
$gateway = PaymentGateway::stripe(['secret_key' => 'sk_test_xxx', 'testMode' => true]);

// Purchase
$response = $gateway->purchase(new PaymentRequest(
    amount:      100.00,
    currency:    'SAR',
    orderId:     'ORDER-001',
    description: 'Premium Plan',
    callbackUrl: 'https://yoursite.com/callback',
    customer:    new Customer(name: 'Ahmed', email: 'ahmed@example.com'),
));

// Redirect customer to payment page
header("Location: {$response->paymentUrl}");

// Check payment status
$status = $gateway->status($response->transactionId);

// Gateway metadata from enum
echo Gateway::TAP->label();           // "Tap Payments"
echo Gateway::TAP->region();          // "MiddleEast"
echo Gateway::TAP->supportsRefund();  // true
echo Gateway::TAP->countries();       // ['KWT', 'SAU', 'ARE', ...]

Factory Pattern

use AzozzALFiras\PaymentGateway\PaymentGateway;

// 1. Generic factory — accepts any driver name string
$gateway = PaymentGateway::create('tap', ['secret_key' => '...']);

// 2. Typed static factory — full IDE autocomplete per gateway
$gateway = PaymentGateway::myfatoorah([...]);
$gateway = PaymentGateway::paylink([...]);
$gateway = PaymentGateway::edfapay([...]);
$gateway = PaymentGateway::tap([...]);
$gateway = PaymentGateway::clickpay([...]);
$gateway = PaymentGateway::tamara([...]);
$gateway = PaymentGateway::thawani([...]);
$gateway = PaymentGateway::fatora([...]);
$gateway = PaymentGateway::payzaty([...]);
$gateway = PaymentGateway::payzah([...]);
$gateway = PaymentGateway::stripe([...]);
$gateway = PaymentGateway::paypal([...]);
$gateway = PaymentGateway::neonpay([...]);
$gateway = PaymentGateway::asiapay([...]);
$gateway = PaymentGateway::zaincash([...]);
$gateway = PaymentGateway::mollie([...]);
$gateway = PaymentGateway::redsys([...]);
$gateway = PaymentGateway::gocardless([...]);

// List all 18 available driver names
PaymentGateway::getAvailableDrivers();

Feature Matrix

Feature
Purchase
Status
Refund
Recurring
Auth/Capture
Customer CRUD
Direct Debit
Webhook

Documentation

Document Description
Gateway Reference Configuration, code examples, and sub-modules for all 18 gateways
Architecture Project structure, directory tree, and design principles
Security Signature verification, input sanitization, and best practices
Webhooks Unified webhook handling across all gateways
Database Integration SQL schemas, models, and full payment flow examples
Contributing How to add gateways, code style, and PR guidelines

Testing

composer install
composer test       # PHPUnit
composer analyse    # PHPStan Level 5

Current test results:

  • PHPUnit: 135 tests, 281 assertions — all passing
  • PHP Lint: all files — zero syntax errors
  • PHPStan Level 5: 0 errors

Contributing

We welcome pull requests! Whether you're adding a new payment gateway, fixing bugs, or improving documentation.

See CONTRIBUTING.md for detailed guidelines on:

  • How to add a new gateway (file structure, contracts, registration)
  • Code style (PHP 8.1+, PSR-12, strict types)
  • Testing requirements
  • PR process

License

MIT License — see LICENSE file.

Author

AzozzALFirasGitHub

azozzalfiras/payment-gateway 适用场景与选型建议

azozzalfiras/payment-gateway 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「composer」 「payment」 「gateway」 「mena」 「kuwait」 「saudi」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 azozzalfiras/payment-gateway 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 azozzalfiras/payment-gateway 我们能提供哪些服务?
定制开发 / 二次开发

基于 azozzalfiras/payment-gateway 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 31
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-16