2017 © Pedro Peláez
 

library invite-code

Library for using invitation codes

image

jasny/invite-code

Library for using invitation codes

  • Monday, February 2, 2015
  • by jasny
  • Repository
  • 2 Watchers
  • 12 Stars
  • 375 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 10 % Grown

The README.md

Jasny Invite code

Build Status, (*1)

This library can be used for requiring invitation codes at registration. This is often the case when an application is in private beta phase., (*2)

Installation

This library is registred at packagist as jasny/invite-code and can be easily installed using composer., (*3)

composer require jasny/invite-code

Generation

To create 100 random invitation codes run the following on the command line, (*4)

mkdir invite-codes
cd invite-codes
for i in {1..100}; do
   CODE=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'A-Z0-9' | fold -w 8 | head -n 1)
   touch $CODE
   echo $CODE
done

Usage

Jasny\InviteCode::setDir('invite-codes');

$invite = new Jasny\InviteCode($_POST['invite']);

if (!$invite->isValid()) {
    echo "Invalid invite code";
    exit();
}

if ($invite->isUsed()) {
    echo "Invite code is already used";
    exit();
}

$invite->useBy($_POST['name']);

The Versions

02/02 2015

dev-master

9999999-dev

Library for using invitation codes

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

28/12 2014

v0.1.0

0.1.0.0 http://jasny.github.com/invite-code

Library for using invitation codes

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires