engalalfy/laravel-payments

A unified Laravel package for multiple payment gateways (Paymob, Kashier, etc.) with easy integration and extensibility.

v1.0.4 2025-06-18 19:18 UTC

README

A unified Laravel package for multiple payment gateways (Paymob, Kashier, etc.) with easy integration and extensibility. Simplify your payment processing with a consistent API across different payment providers.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads License: MIT Issues Pull Requests

Features

  • Unified API: Work with multiple payment gateways using a consistent interface
  • Extensible: Easily add support for new payment gateways
  • Provider Agnostic: Switch between payment providers without changing your application code
  • Event Driven: Leverage Laravel's event system for payment notifications
  • Thorough Documentation: Well-documented API with examples for each supported gateway
  • Robust Testing: Comprehensive test suite for reliability

Package Structure

laravel-payments/
├── config/                  # Configuration files
├── database/
│   └── migrations/          # Database migrations
├── resources/
│   └── views/               # Views for payment pages if needed
├── src/
│   ├── Facades/             # Laravel Facades
│   ├── Gateways/            # Payment gateway implementations
│   │   ├── Paymob/
│   │   ├── Kashier/
│   │   └── ...
│   ├── Contracts/           # Interfaces defining the API
│   ├── Models/              # Eloquent models
│   ├── Events/              # Payment-related events
│   ├── Exceptions/          # Custom exceptions
│   └── LaravelPayments.php  # Main package class
└── tests/                   # Test suite

Installation

You can install the package via composer:

composer require engalalfy/laravel-payments

After installation, publish the configuration and migrations:

php artisan vendor:publish --tag="laravel-payments-config"

Configuration

Configure your payment gateways in the published config file:

// config/laravel-payments.php

return [
    'default' => env('PAYMENT_GATEWAY', 'paymob'),
    
    'gateways' => [
        'paymob' => [
            'api_key' => env('PAYMOB_API_KEY'),
            'integration_id' => env('PAYMOB_INTEGRATION_ID'),
            'iframe_id' => env('PAYMOB_IFRAME_ID'),
            // Additional Paymob configuration...
        ],
        
        'kashier' => [
            'merchant_id' => env('KASHIER_MERCHANT_ID'),
            'api_key' => env('KASHIER_API_KEY'),
            // Additional Kashier configuration...
        ],
        
        // Additional payment gateways...
    ],
    
    'currency' => env('PAYMENT_CURRENCY', 'EGP'),
    'callback_url' => env('PAYMENT_CALLBACK_URL', '/payment/callback'),
];

Basic Usage

Testing

The package comes with a comprehensive test suite:

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details on how to contribute to this package.

Reporting Issues

If you encounter any issues, please open an issue on GitHub.

Pull Requests

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Support the Development

If you find this package helpful, consider supporting its development:

PayPal

Credits

License

The MIT License (MIT). Please see License File for more information.