PHP library to generate and validate coupon code strings
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


Coupon Code
-- PHP library to generate and validate coupon code strings.

This library is a loose port of the CPAN module Algorithm::CouponCode[0] by Grant McLean.


Copyright & License
This library is Copyright (c) 2014 Atelier Disko if not otherwise stated.
The code is distributed under the terms of the BSD 3-clause License. For
the full license text see the LICENSE file.

The preferred installation method is via composer. You can add
the library as a dependency via:

$ composer require atelierdisko/coupon_code


use CouponCode\CouponCode;

$code = new CouponCode();

$result = $code->generate();
// returns a string in `XXXX-XXXX-XXXX` format i.e.
// `1K7Q-CTFM-LMTC`.

// returns a boolean indicating if the code is valid.

// returns `190D-V467-8D52`