PHPackages                             didatus/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. didatus/random-string

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

didatus/random-string
=====================

Class for generating random strings with defined parameters

1.1.1(8y ago)06MITPHPPHP &gt;=7.1

Since Sep 29Pushed 8y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (4)Used By (0)

RandomString
============

[](#randomstring)

A simple class for generating random strings.

[![Latest Stable Version](https://camo.githubusercontent.com/b81f61ee75c001cf4136bf6d775f2e310c4b0688a3e71fd768e9d3540789dc65/68747470733a2f2f706f7365722e707567782e6f72672f646964617475732f72616e646f6d2d737472696e672f762f737461626c65)](https://packagist.org/packages/didatus/random-string)[![License](https://camo.githubusercontent.com/757f5d59a55a19efc5bd95dddd9efd59dfd28f327a0f6f789979888e2ec81d12/68747470733a2f2f706f7365722e707567782e6f72672f646964617475732f72616e646f6d2d737472696e672f6c6963656e7365)](https://packagist.org/packages/didatus/random-string)[![Build Status](https://camo.githubusercontent.com/9d333111ec8c0756fe992dca4c72c47ea9e169b88611669aaf931b96d4257d25/68747470733a2f2f7472617669732d63692e6f72672f646964617475732f52616e646f6d537472696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/didatus/RandomString)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/10065c5ef181cdc7b387431821775cfe42c77da104e2233c62d0e8691aa238cf/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f646964617475732f52616e646f6d537472696e672f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/didatus/RandomString/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/367bd288e5640a9f224b26896147c4b7eef3ecd7ea5b8500b275c2d1ef7e6994/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f646964617475732f52616e646f6d537472696e672f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/didatus/RandomString/?branch=master)

#### Create RandomString Instance

[](#create-randomstring-instance)

```
use Didatus\RandomString\RandomString;
$randomString = new RandomString();
```

#### Create RandomString Instance with own character pool and with excluding characters

[](#create-randomstring-instance-with-own-character-pool-and-with-excluding-characters)

```
use Didatus\RandomString\RandomString;
$randomString = new RandomString('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', '1IO0');
```

Excluding characters can be helpful for generating readable coupons (without confusing 0 and O for example).

#### Generate a single random string

[](#generate-a-single-random-string)

```
$randomString = new RandomString();
$string = $randomString->getString(10);
```

#### Generate a single random alpha numeric string excluding confusing characters

[](#generate-a-single-random-alpha-numeric-string-excluding-confusing-characters)

```
$randomString = new RandomString('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', '1IO0');
$string = $randomString->getString(10);
```

#### generate a list of five random tokens

[](#generate-a-list-of-five-random-tokens)

```
$randomString = new RandomString();
$strings = $randomString->getListOfString(10, 5);
```

C8H5

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~0 days

Total

3

Last Release

3144d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a3c073614ba44e4efc6595a7505c96539dc92d589bb785e46c5e369fda7a97e?d=identicon)[didatus](/maintainers/didatus)

---

Top Contributors

[![didatus](https://avatars.githubusercontent.com/u/1552664?v=4)](https://github.com/didatus "didatus (18 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[phpcr/phpcr-migrations

Migrations for PHPCR

421.4M2](/packages/phpcr-phpcr-migrations)

PHPackages © 2026

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