Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/takuya/php-random-string
Generates random string.
https://github.com/takuya/php-random-string
Last synced: 21 days ago
JSON representation
Generates random string.
- Host: GitHub
- URL: https://github.com/takuya/php-random-string
- Owner: takuya
- License: gpl-3.0
- Created: 2023-01-20T09:00:05.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-04-01T11:10:49.000Z (8 months ago)
- Last Synced: 2024-04-01T12:29:21.406Z (8 months ago)
- Language: PHP
- Size: 42 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![](https://github.com/takuya/php-random-string/workflows/main/badge.svg)
### Examples
```php
use Takuya\RandomString\RandomString;
// use class
RandomString::gen();
RandomString::gen(20,RandomString::ALPHA_NUM);
RandomString::gen(20,RandomString::ALPHA);
RandomString::gen(20,RandomString::ALPHA|RandomString::SYMBOLS);
RandomString::gen(20,RandomString::LOWER|RandomString::SYMBOLS);
RandomString::gen(20,RandomString::UPPER|RandomString::NUMBER);
// use helper generates randomized ALPHA_NUM.
$str = random_string(20);
$str = random_string(10);
```CHARACTERS
```
ALPHA_NUM = (LOWER | UPPER | NUMBER)
ALPHA = (LOWER | UPPER)
LOWER = ( a, b, c ...z )
UPPER = ( A, B, C ...Z )
NUMBER = ( 0, 1, 2,...9 )
```
SYMBOL
```
SYMBOL =
+ array_map( 'chr' , range( 33, 47 ) // !"#$%&'()*+,-./
+ array_map( 'chr' , range( 91, 96 ) // [\]^_`
+ array_map( 'chr' , range(123,126 ) // {|}~
```### Installing
from github```
composer config repositories.'php-random-string' \
vcs https://github.com/takuya/php-random-string
composer require takuya/php-random-string:master
composer install
```
from packagist```
composer require takuya/php-random-string
```
### Testing
```
git clone https://github.com/takuya/php-random-string
cd php-cert-checker
composer install
vendor/bin/phpunit
```