PHPackages                             blunck/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. blunck/coupons

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

blunck/coupons
==============

Coupon generator for Laravel 5

0.3.1(7y ago)2334MITPHPPHP ^7.1

Since Nov 16Pushed 7y agoCompare

[ Source](https://github.com/alexblunck/coupons)[ Packagist](https://packagist.org/packages/blunck/coupons)[ RSS](/packages/blunck-coupons/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)Dependencies (3)Versions (5)Used By (0)

coupons
=======

[](#coupons)

[![Latest Version on Packagist](https://camo.githubusercontent.com/62ba70e99f1063dcf4aaa9bfdc4a2de0fbe9bdac6045cdfb54457fc153ac88b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626c756e636b2f636f75706f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/blunck/coupons)

Coupon generator for Laravel 5.

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

[](#installation)

You can install the package via composer:

```
composer require blunck/coupons
```

The package includes a migration to create a `coupons` &amp; `coupon_user` table:

```
# Publish migration file
php artisan vendor:publish --provider="Blunck\Coupons\CouponServiceProvider"

# Run migration
php artisan migrate
```

Add `Redeemable` trait to `User` model:

```
use Blunck\Coupons\Traits\Redeemable;

class User {
    use Redeemable;

    // ...
}
```

Usage
-----

[](#usage)

#### Retrieve / Check if a coupon code is valid

[](#retrieve--check-if-a-coupon-code-is-valid)

```
try {
    $coupon = Coupons::check('AAAA-BBBB-CCCC');
} catch (CouponException $e) {
    //
}
```

You can optionally pass a user instance as the 2nd argument to `Coupons::check` to check if user has already redeemed a non disposable coupon.

#### Redeem coupon

[](#redeem-coupon)

```
$user->redeemCoupon($coupon);
```

Redeeming a coupon adds a record to the `coupon_user` pivot table.

#### Create Coupon

[](#create-coupon)

```
/**
 * Disposable coupons can only be used onece.
 *
 * @var boolean
 */
$is_disposable = true;

/**
 * Coupon discount.
 *
 * @var float
 */
$discount = 10.50;

/**
 * Days from now when coupon expires. If null
 * coupon never expires.
 *
 * @var integer|null
 */
$expires_in = 30;

/**
 * Additional data.
 *
 * @var array
 */
$data = ['note' => 'lorem ipsum'];

$coupon = Coupons::create($is_disposable, $discount, $expires_in, $data);
$code = $coupon->code;
```

Acknowledgments
---------------

[](#acknowledgments)

Architecture inspired by [laravel-promocodes](https://github.com/zgabievi/laravel-promocodes)

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

Total

4

Last Release

2855d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/63784474?v=4)[Blunck](/maintainers/blunck)[@blunck](https://github.com/blunck)

### Embed Badge

![Health badge](/badges/blunck-coupons/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M337](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M125](/packages/laravel-pulse)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

198321.1k](/packages/fumeapp-modeltyper)[flarum/core

Delightfully simple forum software.

201.4M2.2k](/packages/flarum-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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