Code Monkey home page Code Monkey logo

coupon_code's Introduction

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

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

[0] https://github.com/grantm/Algorithm-CouponCode

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.

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

$ composer require atelierdisko/coupon_code

Quickstart
----------
<?php

use CouponCode\CouponCode;

$code = new CouponCode();

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

$code->validate($result);
// returns a boolean indicating if the code is valid.

$code->normalize('i9oD_V467-8Dsz');
// returns `190D-V467-8D52`

?>

coupon_code's People

Contributors

mariuswilms avatar savah avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.