PHPackages                             iwouldrathercode/php-simple-coupons - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. iwouldrathercode/php-simple-coupons

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

iwouldrathercode/php-simple-coupons
===================================

PHP package to help generates simple and unique coupon codes using random\_bytes

v2.0(3y ago)513.2k↓100%3MITPHPPHP &gt;=7.0

Since Sep 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/iwouldrathercode/php-simple-coupons)[ Packagist](https://packagist.org/packages/iwouldrathercode/php-simple-coupons)[ RSS](/packages/iwouldrathercode-php-simple-coupons/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (3)Used By (0)

iwouldrathercode/php-simple-coupons
===================================

[](#iwouldrathercodephp-simple-coupons)

[![Latest Version on Packagist](https://camo.githubusercontent.com/869b97a6494e64c88b8498e4b7532afed5b0152b8ee62460397cdf7d361b3264/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69776f756c64726174686572636f64652f636f676e69746f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/iwouldrathercode/php-simple-coupons)[![Total Downloads](https://camo.githubusercontent.com/c149ab7ebbffb8bf98898c0584cdfec8e06d017735b1cdca684460eea0d0a164/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f69776f756c64726174686572636f64652f7068702d73696d706c652d636f75706f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/iwouldrathercode/php-simple-coupons)

PHP package to help generates simple and unique coupon codes.

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

[](#installation)

```
composer require iwouldrathercode/php-simple-coupons
```

Usage
-----

[](#usage)

> Generating single coupon codes

```
use Iwouldrathercode\SimpleCoupons\Coupon;

.
.
.
// Somewhere in your code...

$code = new Coupon();

// Coupon code only
$coupon = $code->generate();

// Coupon code with a prefix of `ABC`
$coupon = $code->prepend('ABC')->generate();

// Coupon code with a prefix of `ABC` and suffix of `XYZ`
$coupon = $code->prepend('ABC')->append('XYZ')->generate();

// Coupon code with a prefix of `ABC` and suffix of `XYZ` and max. char. length as - 10
$coupon = $code->limit(10)->generate();
.
.
```

> Generating multiple coupon codes

```
use Iwouldrathercode\SimpleCoupons\Coupon;

.
.
.

// Somewhere in your code...

function generateMultipleCodes($limit, $table)
{
    $couponsArray = [];
    $code = new Coupon();

    // Looping through unti limit is reached
    for($i=1; $ilimit(12)->generate();
    // echo $coloredOutput->apply("color_15", $coupon.PHP_EOL);
    array_push($couponsArray, $coupon);
    $code->__destruct();
}

// Generate 10 coupon codes
$multipleCoupons = generateMultipleCodes(10, $table);
```

> For more examples do refer example.php and performance.php

Credits
-------

[](#credits)

- [Shankar](https://github.com/psgganesh)

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 71% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community9

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

Total

2

Last Release

1442d ago

Major Versions

v1.0 → v2.02022-04-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/889a2d844f502e7c17e55584c90fc02fb54d0850bd51cfc2bc7194eef2894523?d=identicon)[psgganesh](/maintainers/psgganesh)

---

Top Contributors

[![psgganesh](https://avatars.githubusercontent.com/u/2221525?v=4)](https://github.com/psgganesh "psgganesh (23 commits)")

---

Tags

couponcouponsgeneratorlibraryphptokenvouchergeneratortokenSimplevoucheruniquecouponscouponrandom\_bytessimple coupon

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/iwouldrathercode-php-simple-coupons/health.svg)

```
[![Health](https://phpackages.com/badges/iwouldrathercode-php-simple-coupons/health.svg)](https://phpackages.com/packages/iwouldrathercode-php-simple-coupons)
```

###  Alternatives

[simplesoftwareio/simple-qrcode

Simple QrCode is a QR code generator made for Laravel.

2.9k26.8M78](/packages/simplesoftwareio-simple-qrcode)[frittenkeez/laravel-vouchers

Voucher system for Laravel 9+

5818.8k1](/packages/frittenkeez-laravel-vouchers)

PHPackages © 2026

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