PHPackages                             efati/payment-gateway - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. efati/payment-gateway

ActiveLibrary[Payment Processing](/categories/payments)

efati/payment-gateway
=====================

A reusable, multi-gateway Laravel payment package.

v8.1(5mo ago)010MITPHPPHP ^8.2CI passing

Since Dec 3Pushed 5mo agoCompare

[ Source](https://github.com/AfshinEfati/payment-gateway)[ Packagist](https://packagist.org/packages/efati/payment-gateway)[ Docs](https://github.com/AfshinEfati/payment-gateway)[ RSS](/packages/efati-payment-gateway/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (13)Used By (0)

Laravel Payment Gateway
=======================

[](#laravel-payment-gateway)

A reusable, multi-gateway Laravel payment package supporting Iranian banking system.

Features
--------

[](#features)

- **Multiple Gateways**: Support for Zarinpal, Mellat, and more.
- **Dynamic Access**: Access specific gateways easily via Facade (e.g., `Payment::zarinpal()`).
- **Customizable Models**: Publish and customize Bank, Gateway, and Transaction models.
- **Database Support**: Includes migrations and seeders for banks and gateways.
- **DTO Support**: Uses Data Transfer Objects for consistent request/response handling.

Requirements
------------

[](#requirements)

- PHP ^8.2
- Laravel ^11.0 | ^12.0

Installation
------------

[](#installation)

Install the package via composer:

```
composer require efati/payment-gateway
```

Configuration
-------------

[](#configuration)

Run the installation command to publish the config, migrations, seeders, models, and core logic:

```
php artisan payment:install
```

This command will:

1. Publish configuration to `config/payment.php`
2. Publish migrations to `database/migrations`
3. Publish seeders to `database/seeders`
4. Publish models to `app/Models`
5. **Scaffold Core Logic**: Copy Contracts, Gateways, DTOs, and Managers to `app/Payment/`

Run migrations:

```
php artisan migrate
```

Seed the database with banks and gateways:

```
php artisan db:seed --class=PaymentGateway\Database\Seeders\BankSeeder
php artisan db:seed --class=PaymentGateway\Database\Seeders\GatewaySeeder
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

The core logic is now located in `app/Payment`. You can customize any part of it.

Use the `Payment` facade to initialize a payment:

```
use App\Payment\Managers\PaymentManager; // Or use Facade
use PaymentGateway\Facades\Payment;
use App\Payment\DTOs\PaymentRequestDTO;

$dto = new PaymentRequestDTO(
    amount: 10000,
    orderId: 'ORD-123',
    callbackUrl: route('payment.callback'),
    description: 'Order payment',
    mobile: '09123456789'
);

$result = Payment::initialize($dto);
```

### Dynamic Gateway Selection

[](#dynamic-gateway-selection)

```
// Use Zarinpal
Payment::zarinpal()->initialize($dto);
```

### Customization

[](#customization)

Since the code is in `app/Payment`, you can directly edit:

- `app/Payment/Gateways/Zarinpal.php`
- `app/Payment/Managers/PaymentManager.php`
- `app/Payment/DTOs/PaymentRequestDTO.php`

The package automatically detects if these files exist in `app/Payment` and uses them instead of the package defaults.

### Verification

[](#verification)

On your callback route:

```
use PaymentGateway\Facades\Payment;
use PaymentGateway\DTOs\PaymentVerifyDTO;

$dto = new PaymentVerifyDTO(
    amount: 10000,
    authority: request('Authority'), // or whatever the gateway sends
    gateway: 'zarinpal'
);

try {
    $receipt = Payment::verify($dto);
    // $receipt['ref_id'], $receipt['tracking_code']

    return "Payment Successful! Ref ID: " . $receipt['ref_id'];
} catch (\PaymentGateway\Exceptions\PaymentException $e) {
    return "Payment Failed: " . $e->getMessage();
}
```

Customizing Models
------------------

[](#customizing-models)

If you need to extend or modify the models (e.g., to add relationships), you can publish them to your `app/Models` directory:

```
php artisan vendor:publish --tag=efati-payment-models
```

This will copy `Bank`, `PaymentGateway`, and `PaymentTransaction` models to `app/Models`. The package will automatically use your published models if you update the `config/payment.php` file:

```
// config/payment.php
'models' => [
    'bank' => \App\Models\Bank::class,
    'gateway' => \App\Models\PaymentGateway::class,
    'transaction' => \App\Models\PaymentTransaction::class,
],
```

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance71

Regular maintenance activity

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

12

Last Release

165d ago

Major Versions

v1.1.1 → v8.0.22025-12-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/221fabb136de5ddae97db2481098fe26016a129f1bba400d1e219ae0b77f7782?d=identicon)[AfshinEfati](/maintainers/AfshinEfati)

---

Top Contributors

[![AfshinEfati](https://avatars.githubusercontent.com/u/39827008?v=4)](https://github.com/AfshinEfati "AfshinEfati (15 commits)")

### Embed Badge

![Health badge](/badges/efati-payment-gateway/health.svg)

```
[![Health](https://phpackages.com/badges/efati-payment-gateway/health.svg)](https://phpackages.com/packages/efati-payment-gateway)
```

###  Alternatives

[laraveldaily/laravel-invoices

Missing invoices for Laravel

1.5k1.3M4](/packages/laraveldaily-laravel-invoices)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
