PHPackages                             hans-thomas/lyra - 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. hans-thomas/lyra

ActiveLibrary[Payment Processing](/categories/payments)

hans-thomas/lyra
================

payment gateway with offline purchase support

v1.0.0(2y ago)16MITPHPPHP ^8.1

Since Oct 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/hans-thomas/lyra)[ Packagist](https://packagist.org/packages/hans-thomas/lyra)[ RSS](/packages/hans-thomas-lyra/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Lyra
====

[](#lyra)

[![lyra banner](assets/lyra-banner.png)](assets/lyra-banner.png)

[![codecov](https://camo.githubusercontent.com/6d7fd53fd65dc70b79e36f439bca15ac92ae7cb47aeff18222a090e6e29a2c40/68747470733a2f2f636f6465636f762e696f2f67682f68616e732d74686f6d61732f6c7972612f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d5831443649304a4c535a)](https://codecov.io/gh/hans-thomas/lyra)[![GitHub Workflow Status](https://camo.githubusercontent.com/af8e596171b9a2b2eec2bbaed7d36a2a7d41040a53863b7e650ee32a1948f646/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f68616e732d74686f6d61732f6c7972612f7068702e796d6c)](https://camo.githubusercontent.com/af8e596171b9a2b2eec2bbaed7d36a2a7d41040a53863b7e650ee32a1948f646/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f68616e732d74686f6d61732f6c7972612f7068702e796d6c)[![GitHub top language](https://camo.githubusercontent.com/95240594859b01d99a77347c73b73d226412e297c28ff37eddeadd572c023119/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f68616e732d74686f6d61732f6c797261)](https://camo.githubusercontent.com/95240594859b01d99a77347c73b73d226412e297c28ff37eddeadd572c023119/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f68616e732d74686f6d61732f6c797261)[![GitHub release (latest by date)](https://camo.githubusercontent.com/3be4d92de292dbf886efbef781b1d19316131609f39877bae985ae2417d2d3fd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f68616e732d74686f6d61732f6c797261)](https://camo.githubusercontent.com/3be4d92de292dbf886efbef781b1d19316131609f39877bae985ae2417d2d3fd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f68616e732d74686f6d61732f6c797261)[![StyleCi](https://camo.githubusercontent.com/294e0e9d20b535abeac121743f73c23b7f068590e0c3599ffb1b0bf119e8e6d3/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3638313035323836362f736869656c643f7374796c653d706c6173746963)](https://camo.githubusercontent.com/294e0e9d20b535abeac121743f73c23b7f068590e0c3599ffb1b0bf119e8e6d3/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3638313035323836362f736869656c643f7374796c653d706c6173746963)

Lyra is a payment package that supports offline purchases as well. There are two defined gateway by default, but you can implement your own gateway(s).

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

[](#installation)

Via composer

```
composer require hans-thomas/lyra
```

Then publish the config file

```
php artisan vendor:publish --tag lyra-config
```

Usage
-----

[](#usage)

Lyra supports online and offline modes. First, we are going to introduce the online mode.

### Online purchase

[](#online-purchase)

#### Pay

[](#pay)

You can call the `pay` method and pass the amount to pay for a purchase.

```
Lyra::pay(10000);
```

#### getRedirectUrl

[](#getredirecturl)

After calling `pay` method, you can call `getRedirectUrl` method to get the gateway URL as a string.

```
Lyra::pay(10000)->getRedirectUrl();
```

#### redirect

[](#redirect)

Also, you can call `redirect` method to redirect the user to the gateway URL after calling the `pay` method.

```
Lyra::pay(10000)->redirect();
```

#### setGateway

[](#setgateway)

You can set another gateway **before calling the `pay` method** and override the default one.

```
Lyra::setGateway(Payir::class, 10000)->pay();
```

#### verify

[](#verify)

To verify the purchase, on callback, you can call `verify` method and pass the payment amount.

```
Lyra::verify(10000);
```

#### getInvoice

[](#getinvoice)

After calling `pay` method, you can get the created invoice using `getInvoice` method.

```
Lyra::pay(10000)->getInvoice();
```

### Offline purchase

[](#offline-purchase)

#### pay

[](#pay-1)

To purchase an offline payment, you must call `offline` method first and then `pay` method.

```
Lyra::offline()->pay($file, $amount = 10000);
```

#### getInvoice

[](#getinvoice-1)

Also, in offline mode, you can call `getInvoice` method to get the created invoice after the `pay` method.

```
Lyra::offline()->pay($file, 10000)->getInvoice();
```

#### accept

[](#accept)

To accept an offline purchase, call `accept` method and pass the related invoice.

```
Lyra::offline()->accept($invoice);
```

#### deny

[](#deny)

To deny a purchase, call `deny` method.

```
Lyra::offline()->deny($invoice);
```

Contributing
------------

[](#contributing)

1. Fork it!
2. Create your feature branch: git checkout -b my-new-feature
3. Commit your changes: git commit -am 'Add some feature'
4. Push to the branch: git push origin my-new-feature
5. Submit a pull request ❤️

Support
-------

[](#support)

- [Report bugs](https://github.com/hans-thomas/lyra/issues)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.4% 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

Unknown

Total

1

Last Release

951d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39920372?v=4)[Mohammad Mortazavi](/maintainers/hans-thomas)[@hans-thomas](https://github.com/hans-thomas)

---

Top Contributors

[![hans-thomas](https://avatars.githubusercontent.com/u/39920372?v=4)](https://github.com/hans-thomas "hans-thomas (135 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (16 commits)")

---

Tags

laravellaravel-packagepaymentpayment-gateway

### Embed Badge

![Health badge](/badges/hans-thomas-lyra/health.svg)

```
[![Health](https://phpackages.com/badges/hans-thomas-lyra/health.svg)](https://phpackages.com/packages/hans-thomas-lyra)
```

###  Alternatives

[chargebee/chargebee-php

ChargeBee API client implementation for PHP

768.0M9](/packages/chargebee-chargebee-php)[imdhemy/google-play-billing

Google Play Billing

491.3M5](/packages/imdhemy-google-play-billing)[bitpay/sdk

Complete version of the PHP library for the new cryptographically secure BitPay API

42337.5k4](/packages/bitpay-sdk)[buckaroo/sdk

Buckaroo payment SDK

12189.1k9](/packages/buckaroo-sdk)[contica/facturador-electronico-cr

Un facturador de código libre para integrar facturación electrónica en Costa Rica a un proyecto PHP

2128.8k](/packages/contica-facturador-electronico-cr)[karson/mpesa-php-sdk

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

PHPackages © 2026

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