项目作者: Nakroma

项目描述 :
Random and unique key generation for PHP web applications
高级语言: PHP
项目地址: git://github.com/Nakroma/cereal.git
创建时间: 2017-03-15T19:05:31Z
项目社区:https://github.com/Nakroma/cereal

开源协议:MIT License

下载


Latest Version
Software License

Cereal

Cereal generates random unique keys, for example as game or license keys.

Usage

  1. use Nakroma\Cereal;
  2. Cereal::generate();
  3. // Output: B539-F8B7-943B-BAF5-82F6-CCF7-5ACB-B4A2

Configuration

You can pass Cereal::generate() a bunch of options in an array, like this:

  1. Cereal::generate(['length' => 16, 'uppercase' => false]);

These are all the options you can use and their default values:

  1. length: 32 // Changes the length of the string
  2. // 16 => D423-3332-2919-D000
  3. delimiter: '-' // Changes the char between each chunk
  4. // '@' => FDB2@4C41@C6DD@0B99@7FBD@ADF5@3345@058E
  5. delimiterSpacing: 4 // Changes the chunk size after before each delimiter
  6. // 8 => EA989521-282013EA-49B8D6CB-90DA28D8
  7. uppercase: true // Changes if the string is upper or lower case
  8. // false => c724-bbb9-b205-0995-d8b8-3d65-0e4d-6c3b
  9. numbers: true // Enables the generation of numbers in the key
  10. // false => VHUX-CDDE-CFFG-NKSC-SDEK-LFWX-OBCW-IOZC
  11. chars: true // Enables the generation of chars in the key
  12. // false => 7222-2371-3276-8402-7594-0803-3961-6800

Installation

Run composer require nakroma/cereal