https://github.com/ajaxray/short-code
ShortCode generator for PHP. Create short, reversible or random, hash like codes.
https://github.com/ajaxray/short-code
hash php php-library shortcode
Last synced: about 2 months ago
JSON representation
ShortCode generator for PHP. Create short, reversible or random, hash like codes.
- Host: GitHub
- URL: https://github.com/ajaxray/short-code
- Owner: ajaxray
- License: mit
- Created: 2015-10-22T21:40:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-11-13T13:27:36.000Z (over 3 years ago)
- Last Synced: 2024-09-15T07:19:36.997Z (8 months ago)
- Topics: hash, php, php-library, shortcode
- Language: PHP
- Homepage:
- Size: 38.1 KB
- Stars: 29
- Watchers: 5
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ShortCode
[](https://insight.sensiolabs.com/projects/8254062e-538a-4667-aa56-920e293bef5a)
[](https://travis-ci.org/ajaxray/short-code)
[](https://coveralls.io/github/ajaxray/short-code?branch=master)
[](https://packagist.org/packages/ajaxray/short-code)
[](https://packagist.org/packages/ajaxray/short-code)
[](https://packagist.org/packages/ajaxray/short-code)ShortCode generator for PHP. Create short, hash like codes. Codes can be random or reversible. Output format is customizable (see the list below).
You can generate random string code of your desired character length, e.g. 4, 6, 8 ... up to 20.
Also, you can generate reversible codes from numbers. It's useful when you'll need to trace the original number from a reference code string.Can be used for generating small reference codes, tiny URLs or any other purpose.
## Installation
Install the latest version with
```
$ composer require ajaxray/short-code
```## Supported Output and Conversion Formats
- `ShortCode\Code::FORMAT_ALNUM` : (Default) Alphanumaric characters. includes 0-9, a-z and A-Z
- `ShortCode\Code::FORMAT_ALNUM_CAPITAL` : Alphanumaric characters. includes 0-9 and A-Z
- `ShortCode\Code::FORMAT_ALNUM_SMALL` : Alphanumaric characters. includes 0-9 and a-z
- `ShortCode\Code::FORMAT_CHAR_CAPITAL` : Capital letter characters. includes only A-Z
- `ShortCode\Code::FORMAT_CHAR_SMALL` : Small letter characters. includes only a-z
- `ShortCode\Code::FORMAT_NUMBER` : Numbers. includes only 0-9. Can be used for random number generation## Generating Random Code
```php
"This is the Book about which there is no doubt, a guidance for those conscious of Allah" - [Al-Quran](http://quran.com)