PHPackages                             yasserbenaioua/chargily-epay-laravel - 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. yasserbenaioua/chargily-epay-laravel

ActiveLibrary[Payment Processing](/categories/payments)

yasserbenaioua/chargily-epay-laravel
====================================

A laravel package for chargily epay gateway

1.0.1(3y ago)016MITPHPPHP ^8.0

Since Sep 14Pushed 3y ago1 watchersCompare

[ Source](https://github.com/yasserbenaioua/chargily-epay-laravel)[ Packagist](https://packagist.org/packages/yasserbenaioua/chargily-epay-laravel)[ Docs](https://github.com/yasserbenaioua/chargily-epay-laravel)[ RSS](/packages/yasserbenaioua-chargily-epay-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (3)Used By (0)

A laravel package for chargily epay gateway
===========================================

[](#a-laravel-package-for-chargily-epay-gateway)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d49f32b17c69d63a6e9ff2e3964925695d29a3c59669465c86a546eb5cd37628/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79617373657262656e61696f75612f6368617267696c792d657061792d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yasserbenaioua/chargily-epay-laravel)[![GitHub Tests Action Status](https://camo.githubusercontent.com/f80920374a3fc889c13f336584284144d595e1f71c426f46fdf712ffefa293ce/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f79617373657262656e61696f75612f6368617267696c792d657061792d6c61726176656c2f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/yasserbenaioua/chargily-epay-laravel/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/7e0c5f88983789a0c222d50f0800c4846460ccf6f6de3a1919a6615d7a68505e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f79617373657262656e61696f75612f6368617267696c792d657061792d6c61726176656c2f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/yasserbenaioua/chargily-epay-laravel/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/54eb14d72e48a3858a8b70730fbaa3caa57c0ebdec297fe160d152a88d79b0aa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79617373657262656e61696f75612f6368617267696c792d657061792d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yasserbenaioua/chargily-epay-laravel)

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

[](#installation)

You can install the package via composer:

```
composer require yasserbenaioua/chargily-epay-laravel
```

You must publish the config file with:

```
php artisan vendor:publish --provider="YasserBenaioua\Chargily\ChargilyServiceProvider" --tag="chargily-config"
```

This is the contents of the config file that will be published at `config/chargily.php` :

```
use YasserBenaioua\Chargily\Models\ChargilyWebhookCall;

return [

    /*
    * Chargily Api Key
    * You can found it on your epay.chargily.com.dz Dashboard.
    */
    'key' => env('CHARGILY_API_KEY'),

    /*
    * Chargily Api Secret
    * Your Chargily secret, which is used to verify incoming requests from Chargily.
    * You can found it on your epay.chargily.com.dz Dashboard.
    */
    'secret' => env('CHARGILY_API_SECRET'),

    /*
    * This is where client redirected after payment processing.
    */
    'back_url' => 'valid-url-to-redirect-after-payment',

    /*
    * This is where you receive payment informations.
    */
    'webhook_url' => 'valid-url-to-receive-payment-informations',

    /*
     * You can define the job that should be run when a chargily webhook hits your application
     * here.
     */
    'jobs' => [
        // \App\Jobs\HandleChargilyWebhook::class,
    ],

    /*
     * This model will be used to store all incoming webhooks.
     * It should be or extend `YasserBenaioua\Chargily\Models\ChargilyWebhookCall`
     */
    'model' => ChargilyWebhookCall::class,

    /*
     * When running `php artisan model:prune` all stored Chargily webhook calls
     * that were successfully processed will be deleted.
     *
     * More info on pruning: https://laravel.com/docs/8.x/eloquent#pruning-models
     */
    'prune_webhook_calls_after_days' => 10,

    /*
     * When disabled, the package will not verify if the signature is valid.
     * This can be handy in local environments.
     */
    'verify_signature' => env('CHARGILY_SIGNATURE_VERIFY', true),
];
```

Next, you must publish the migration with:

```
php artisan vendor:publish --provider="YasserBenaioua\Chargily\ChargilyServiceProvider" --tag="chargily-migrations"
```

After the migration has been published, you can create the `chargily_webhook_calls` table by running the migrations:

```
php artisan migrate
```

Finally, take care of the routing: At the chargily config file you must configure at what URL Chargily webhook should be sent. In the routes file of your app you must pass that route to the `Route::githubWebhooks` route macro:

```
Route::chargilyWebhook('webhook-route-configured-at-the-chargily-config-file');
```

Behind the scenes this macro will register a `POST` route to a controller provided by this package. We recommend to put it in the `api.php` routes file, so no session is created when a webhook comes in, and no CSRF token is needed.

Should you, for any reason, have to register the route in your `web.php` routes file, then you must add that route to the `except` array of the `VerifyCsrfToken` middleware:

```
protected $except = [
    'webhook-route-configured-at-the-chargily-config-file',
];
```

Usage
-----

[](#usage)

Firstly, you may create a payment like this:

```
use YasserBenaioua\Chargily\Chargily;

$chargily = new Chargily([
    //mode
    'mode' => 'EDAHABIA', //OR CIB
    //payment details
    'payment' => [
        'number' => 'payment-number-from-your-side', // Payment or order number
        'client_name' => 'client name', // Client name
        'client_email' => 'client_email@mail.com', // This is where client receive payment receipt after confirmation
        'amount' => 75, //this the amount must be greater than or equal 75
        'discount' => 0, //this is discount percentage between 0 and 99
        'description' => 'payment-description', // this is the payment description
    ]
]);
```

then use `getRedirectUrl()` method to get the checkout link:

```
use YasserBenaioua\Chargily\Chargily;

$chargily = new Chargily([
    //mode
    'mode' => 'EDAHABIA', //OR CIB
    //payment details
    'payment' => [
        'number' => 'payment-number-from-your-side', // Payment or order number
        'client_name' => 'client name', // Client name
        'client_email' => 'client_email@mail.com', // This is where client receive payment receipt after confirmation
        'amount' => 75, //this the amount must be greater than or equal 75
        'discount' => 0, //this is discount percentage between 0 and 99
        'description' => 'payment-description', // this is the payment description
    ]
]);

$redirectUrl = $chargily->getRedirectUrl();
//like : https://epay.chargily.com.dz/checkout/random_token_here

return redirect($redirectUrl);
```

Chargily will sign all requests hitting the webhook url of your app. This package will automatically verify if the signature is valid.

Unless something goes terribly wrong, this package will always respond with a `200` to webhook requests. All webhook requests with a valid signature will be logged in the `chargily_webhook_calls` table. The table has a payload column where the entire payload of the incoming webhook is saved.

If the signature is not valid, the request will not be logged in the `chargily_webhook_calls` table but a `Spatie\WebhookClient\Exceptions\InvalidWebhookSignature` exception will be thrown. If something goes wrong during the webhook request the thrown exception will be saved in the exception column. In that case the controller will send a `500` instead of `200`.

To handle webhook requests you can define a job that does the work. Here's an example of such a job:

```
namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use YasserBenaioua\Chargily\Models\ChargilyWebhookCall;

class HandleChargilyWebhook implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct(
        public ChargilyWebhookCall $webhookCall
    ) {
        //
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        // do your work here

        // you can access the payload of the webhook call with `$this->webhookCall->payload`
    }
}
```

After having created your job you must register it at the `jobs` array in the `chargily.php` config file.

```
// config/chargily.php

'jobs' => [
    \App\Jobs\HandleChargilyWebhook::class,
],
```

Deleting processed webhooks
---------------------------

[](#deleting-processed-webhooks)

The `YasserBenaioua\Chargily\Models\ChargilyWebhookCall` is `MassPrunable`. To delete all processed webhooks every day you can schedule this command.

```
$schedule->command('model:prune', [
    '--model' => [\YasserBenaioua\Chargily\Models\ChargilyWebhookCall::class],
])->daily();
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Yasser Benaioua](https://github.com/yasserbenaioua)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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 ~3 days

Total

2

Last Release

1334d ago

PHP version history (2 changes)1.0.0PHP ^8.1

1.0.1PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/821d9cf9a9da2d78a395ebb59a05645fbb9aad8b9380dd37e6cb514d60a243aa?d=identicon)[yasser](/maintainers/yasser)

---

Top Contributors

[![yasserbenaioua](https://avatars.githubusercontent.com/u/49347629?v=4)](https://github.com/yasserbenaioua "yasserbenaioua (2 commits)")

---

Tags

chargilycibedahabiaepaygatewaylaravelpackagesatimlaravelchargilycibedahabiayasserbenaiouachargily-epay-laravel

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/yasserbenaioua-chargily-epay-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/yasserbenaioua-chargily-epay-laravel/health.svg)](https://phpackages.com/packages/yasserbenaioua-chargily-epay-laravel)
```

###  Alternatives

[danestves/laravel-polar

A package to easily integrate your Laravel application with Polar.sh

7812.3k](/packages/danestves-laravel-polar)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[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)[spatie/laravel-mailcoach-sdk

An SDK to easily work with the Mailcoach API in Laravel apps

41290.2k1](/packages/spatie-laravel-mailcoach-sdk)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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