PHPackages                             takuya/php-random-string - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. takuya/php-random-string

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

takuya/php-random-string
========================

generate random string.

0.1(3y ago)0651—0%1GPL-3.0-or-laterPHPCI passing

Since Jan 20Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/takuya/php-random-string)[ Packagist](https://packagist.org/packages/takuya/php-random-string)[ RSS](/packages/takuya-php-random-string/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (1)

[![](https://github.com/takuya/php-random-string/workflows/main/badge.svg)](https://github.com/takuya/php-random-string/workflows/main/badge.svg)

### Examples

[](#examples)

```
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

[](#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

[](#testing)

```
git clone https://github.com/takuya/php-random-string
cd php-cert-checker
composer install
vendor/bin/phpunit

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance59

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1214d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab28766f469b5f1770a63613c5f51d661226e01bd2abd180ad5460e537e7d4fa?d=identicon)[takuya](/maintainers/takuya)

---

Top Contributors

[![takuya](https://avatars.githubusercontent.com/u/55338?v=4)](https://github.com/takuya "takuya (183 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/takuya-php-random-string/health.svg)

```
[![Health](https://phpackages.com/badges/takuya-php-random-string/health.svg)](https://phpackages.com/packages/takuya-php-random-string)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
