PHPackages                             escolalms/payments - 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. escolalms/payments

ActivePackage[Payment Processing](/categories/payments)

escolalms/payments
==================

Escola LMS Payments Package.

0.2.20(2y ago)061.6k—10%4MITPHPPHP &gt;=7.4

Since Jun 17Pushed 1y ago2 watchersCompare

[ Source](https://github.com/EscolaLMS/payments)[ Packagist](https://packagist.org/packages/escolalms/payments)[ RSS](/packages/escolalms-payments/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (13)Versions (47)Used By (4)

Payments
========

[](#payments)

[![swagger](https://camo.githubusercontent.com/bf46f50926ef796b1bb0b6e41af746af52ff3aacdffb0533450f3b614a7334a2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d737761676765722d677265656e)](https://escolalms.github.io/payments/)[![codecov](https://camo.githubusercontent.com/3db243e85f88daf17b8a10c6424fdafc531d78152d40c1525ae1f97a6eb60377/68747470733a2f2f636f6465636f762e696f2f67682f4573636f6c614c4d532f7061796d656e74732f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4e52414e34523841475a)](https://codecov.io/gh/EscolaLMS/payments)[![phpunit](https://github.com/EscolaLMS/payments/actions/workflows/test.yml/badge.svg)](https://github.com/EscolaLMS/payments/actions/workflows/test.yml)[![downloads](https://camo.githubusercontent.com/19c710d3085dc0308edef45e9ccb853237c773a11ee9f1223da028a8498b7aca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6573636f6c616c6d732f7061796d656e7473)](https://packagist.org/packages/escolalms/payments)[![downloads](https://camo.githubusercontent.com/34bcc520c7becac132c58bd3382138582e73f814156eca2b924c258b7e4664bd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6573636f6c616c6d732f7061796d656e7473)](https://packagist.org/packages/escolalms/payments)[![downloads](https://camo.githubusercontent.com/b4ce4edda3598b72f88a900e4e3ae94ccca996dc272a4a7f2dd0596615fe7947/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6573636f6c616c6d732f7061796d656e7473)](https://packagist.org/packages/escolalms/payments)[![Maintainability](https://camo.githubusercontent.com/80e1d421ed6d09f32ece667d7f631802df0b0bfdd22979f8dc23d8eec806dd80/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f65343261393466323063373662373139666333382f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/EscolaLMS/payments/maintainability)[![Mutation testing badge](https://camo.githubusercontent.com/05298471d830a17fd66605798b6e973a7412c74c1b9af35f0e1dcb8744009603/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d2532464573636f6c614c4d532532467061796d656e74732532466d61696e)](https://dashboard.stryker-mutator.io/reports/github.com/EscolaLMS/payments/main)

Purpose
-------

[](#purpose)

This package lets you create Payments and process them using integrations with external payment providers (gateways).

Dependencies
------------

[](#dependencies)

- Stripe integration is based on `league/omnipay` and `omnipay/stripe` packages.
- Przelewy24 integration is based on `mnastalski/przelewy24-php` package.
- Optional integration with `escolalms/settings` package enables changing payment gateway api keys &amp; secrets using Settings API (and Admin Panel).

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

[](#installation)

- `composer require escolalms/payments`
- `php artisan migrate`
- `php artisan db:seed --class="EscolaLms\Cart\Database\Seeders\CartPermissionSeeder"`

Usage
-----

[](#usage)

### Facades

[](#facades)

#### Payments Facade

[](#payments-facade)

Use `EscolaLms\Payments\Facades\Payments` for starting payment processing. You can create PaymentProcessor` either from a model using Payable trait or from precreated Payment object.

```
use EscolaLms\Cart\Models\Cart;
use EscolaLms\Payments\Dtos\PaymentMethodDto;
use EscolaLms\Payments\Facades\Payments;

$payable = Cart::find($id); // Cart must implement Payable interface and use Payable trait
$paymentMethodDto = PaymentMethodDto::instantiateFromRequest($request);
$processor = Payments::processPayment($payable);
$processor->purchase($paymentMethodDto); // will emit PaymentPaid event on success
if($payment->status->is(PaymentStatus::PAID)){
    // ...
}
```

#### PaymentGateway Facade

[](#paymentgateway-facade)

With `EscolaLms\Payments\Facades\PaymentGateway` you can call payment provider gateways directly.

For existing payment you can for example do:

```
use EscolaLms\Payments\Dtos\PaymentMethodDto;
use EscolaLms\Payments\Facades\PaymentGateway;
use EscolaLms\Payments\Models\Payment;

$payment = Payment::find($id);
$paymentMethodDto = PaymentMethodDto::instantiateFromRequest($request);
$paymentDto = PaymentDto::instantiateFromPayment($payment); // or you can create it manually
PaymentGateway::purchase($paymentDto, $paymentMethodDto); // will use default payment driver
```

**Important**: This will not save `Payment` object.

To use specific driver, you can call

```
PaymentGateway::driver('stripe')->purchase($paymentDto, $paymentMethodDto);
```

#### Available payment drivers

[](#available-payment-drivers)

- **stripe** (using `Stripe Payment Intent`)
- **free**
- **przelewy24**
- TODO: *stripe-checkout*

### Payable Trait &amp; Interface

[](#payable-trait--interface)

`Payable` trait and interface are the core of this package, enabling simplified calling of `PaymentsService` and `GatewayManager`. When you include it in your model that represents a `Payable` (for example `Cart` or `Order` or `Product`) you can begin payment processing for that `Payable` by calling `$payable->process()`which calls `Payments::processPayable($this)` and automatically creates a `Payment` and returns a `PaymentProcessor` instance for that Payment.

`EscolaLms\Cart` package uses this trait and interface in `EscolaLms\Cart\Models\Order`.

### Payment Processor

[](#payment-processor)

`EscolaLms\Payments\Entities\PaymentProcessor` is a special class which wraps around `Payment`and contains functionality related to processing that payment, for example generating links to payment gateways, automatically setting payment status after purchase, emiting events related to payment status, etc.

```
use EscolaLms\Payments\Dtos\PaymentMethodDto;
use EscolaLms\Payments\Entities\PaymentProcessor;
use EscolaLms\Payments\Models\Payment;

$payment = Payment::find($id);
$paymentMethodDto = PaymentMethodDto::instantiateFromRequest($request);
$processor = new PaymentProcessor($payment); // instead of using Payments facade
$processor->purchase($paymentMethodDto);
```

`PaymentProcessor` automatically selects `free` driver when payment amount equals 0.

### Payment Model

[](#payment-model)

This package defines a `EscolaLms\Payments\Models\Payment` which contains all data abount given payment required for payment gateways to work.

Endpoints
---------

[](#endpoints)

All the endpoints are defined in [![swagger](https://camo.githubusercontent.com/bf46f50926ef796b1bb0b6e41af746af52ff3aacdffb0533450f3b614a7334a2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d737761676765722d677265656e)](https://escolalms.github.io/payments/).

Tests
-----

[](#tests)

Run `./vendor/bin/phpunit` to run tests. See [tests/Mocks/Payable](tests/Mocks/Payable.php) as an example how a Payable is defined.

Test details: [![codecov](https://camo.githubusercontent.com/56b989cfd57686b30ff545f80c1abea2176ea0dd6754267e4ab49eea927aaaf3/68747470733a2f2f636f6465636f762e696f2f67682f4573636f6c614c4d532f46696c65732f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4e52414e34523841475a)](https://codecov.io/gh/EscolaLMS/payments)[![phpunit](https://github.com/EscolaLMS/payments/actions/workflows/test.yml/badge.svg)](https://github.com/EscolaLMS/payments/actions/workflows/test.yml)

Events
------

[](#events)

- `EscolaLms\Payments\Events\PaymentCancelled` - - emited after payment processing is cancelled (by user action or possibly by timeout sent from payment gateway)
- `EscolaLms\Payments\Events\PaymentFailed` - emited after payment has failed (payment gateway returns error)
- `EscolaLms\Payments\Events\PaymentRegistered` - emited when new Payment is created
- `EscolaLms\Payments\Events\PaymentSuccess` - emited when payment gateway returns success

Listeners
---------

[](#listeners)

No Listeners are defined in this package.

How to use this package on Frontend
-----------------------------------

[](#how-to-use-this-package-on-frontend)

### Admin Panel

[](#admin-panel)

#### **Left Menu**

[](#left-menu)

[![Admin panel menu](docs/menu.png "Admin panel menu")](docs/menu.png)

#### **List of Payments**

[](#list-of-payments)

[![List of Payments](docs/list.png "List of Payments")](docs/list.png)

Permissions
-----------

[](#permissions)

Permissions are defined in [Enum](src/Enums/CartPermissionsEnum.php) and seeded in [Seeder](database/seeders/CartPermissionSeeder.php).

Roadmap. Todo. Troubleshooting
------------------------------

[](#roadmap-todo-troubleshooting)

- ???

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~11 days

Total

45

Last Release

741d ago

PHP version history (2 changes)0.0.1PHP ^7.4|^8.0

0.2.14PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/c857f3115c790c573d0617d7e9ba4011269ef7b9dfdb003dc4388846a62b14f7?d=identicon)[qunabu](/maintainers/qunabu)

---

Top Contributors

[![pa-cholek](https://avatars.githubusercontent.com/u/5345420?v=4)](https://github.com/pa-cholek "pa-cholek (41 commits)")[![shdpl](https://avatars.githubusercontent.com/u/279424?v=4)](https://github.com/shdpl "shdpl (13 commits)")[![qunabu](https://avatars.githubusercontent.com/u/214608?v=4)](https://github.com/qunabu "qunabu (9 commits)")[![dyfero](https://avatars.githubusercontent.com/u/59400506?v=4)](https://github.com/dyfero "dyfero (8 commits)")[![HerbertIV](https://avatars.githubusercontent.com/u/62691459?v=4)](https://github.com/HerbertIV "HerbertIV (7 commits)")[![mako321](https://avatars.githubusercontent.com/u/59456825?v=4)](https://github.com/mako321 "mako321 (7 commits)")[![daVitekPL](https://avatars.githubusercontent.com/u/58150098?v=4)](https://github.com/daVitekPL "daVitekPL (5 commits)")[![KrzysztofDziedziechEscolasoft](https://avatars.githubusercontent.com/u/96292232?v=4)](https://github.com/KrzysztofDziedziechEscolasoft "KrzysztofDziedziechEscolasoft (1 commits)")[![dicani0](https://avatars.githubusercontent.com/u/58490533?v=4)](https://github.com/dicani0 "dicani0 (1 commits)")

---

Tags

laravelpaymentstripe

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/escolalms-payments/health.svg)

```
[![Health](https://phpackages.com/badges/escolalms-payments/health.svg)](https://phpackages.com/packages/escolalms-payments)
```

###  Alternatives

[lemonsqueezy/laravel

A package to easily integrate your Laravel application with Lemon Squeezy.

58596.1k](/packages/lemonsqueezy-laravel)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

322.8k](/packages/duncanmcclean-statamic-cargo)[wandesnet/mercadopago-laravel

PHP SDK for integration with Mercado Pago

252.4k](/packages/wandesnet-mercadopago-laravel)[tsaiyihua/laravel-linepay

linepay library for laravel

102.9k](/packages/tsaiyihua-laravel-linepay)

PHPackages © 2026

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