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 4d 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 37% 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

2808d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/02e36ad9869fc38fe1eaf655e0312105c553d32049a93364375e39f523d9402a?d=identicon)[blunck](/maintainers/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

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[kirschbaum-development/commentions

A package to allow you to create comments, tag users and more

12369.2k](/packages/kirschbaum-development-commentions)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)[glhd/special

1929.4k](/packages/glhd-special)

PHPackages © 2026

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