Download the PHP package hidehalo/nanoid-php without Composer
On this page you can find all versions of the php package hidehalo/nanoid-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hidehalo/nanoid-php
More information about hidehalo/nanoid-php
Files in hidehalo/nanoid-php
Package nanoid-php
Short Description A copy of nanoid in PHP
License MIT
Homepage https://github.com/hidehalo/nanoid-php
Informations about the package nanoid-php
Nanoid-php
A tiny (179 bytes), secure URL-friendly unique string ID generator for JavaScript
Safe. It uses cryptographically strong random APIs and guarantees a proper distribution of symbols.
Small. Only 179 bytes (minified and gzipped). No dependencies. It uses Size Limit to control size.
Compact. It uses more symbols than UUID (A-Za-z0-9_-) and has the same number of unique options in just 21 symbols instead of 36.
Thanks awesome ai and his nanoid, this package is a copy in PHP! If you like nanoid and you want to use it in PHP, try me :D
Install
Via Composer
Usage
Normal
The main module uses URL-friendly symbols (A-Za-z0-9_-) and returns an ID with 21 characters (to have the same collisions probability as UUID v4).
Custom Alphabet or Length
Alphabet must contain 256 symbols or less. Otherwise, the generator will not be secure.
Custom Random Bytes Generator
random
callback must accept the array size and return an array with random numbers.If you want to use the same URL-friendly symbols with
format
, you can get default alphabet from theurl
module:
Please see CoreInterface::random(...)
for the core random API prototype and notes
Examples
Please see Examples for more information on detailed usage.
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
Contributing
Please see CODE_OF_CONDUCT for details.
Notice
If you have any issues, just feel free and open it in this repository, thx!
Credits
License
The MIT License (MIT). Please see License File for more information.