PHPackages                             swuppio/randstring - 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. swuppio/randstring

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

swuppio/randstring
==================

Generate random string

1.0.0(2y ago)03MITPHPPHP &gt;=7.4

Since Feb 23Pushed 2y ago1 watchersCompare

[ Source](https://github.com/swuppio/randstring)[ Packagist](https://packagist.org/packages/swuppio/randstring)[ RSS](/packages/swuppio-randstring/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

RandString
==========

[](#randstring)

*This package was created for my personal use, but if you find it useful, feel free to use it*

It helps generate random strings

Installation
------------

[](#installation)

### Via Composer

[](#via-composer)

```
composer require swuppio/randstring

```

Get Started
-----------

[](#get-started)

### Params description

[](#params-description)

```
gen(int $length = 5, ?string $symbols = null): string
```

- *int* `$length` - The desired length of the generated random string. Specifies how many characters the resulting string should contain (default = 5)
- *?string* `$symbols` - An optional string of characters from which the random string will be generated. If not provided, the method will use a default set of characters returned by the `getChars()` method

The method returns a randomly generated string

### Example

[](#example)

#### Generate a random string using default parameters:

[](#generate-a-random-string-using-default-parameters)

```
echo RandString::gen();
```

#### Generate a 10-character long random string using a custom set of characters:

[](#generate-a-10-character-long-random-string-using-a-custom-set-of-characters)

```
echo RandString::gen(10, 'abc123');
```

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 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

906d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ce5fcbd1d1faaaf59586f52e1215470e23d192f63f2cba41283cedf915b3ccc?d=identicon)[swuppio](/maintainers/swuppio)

---

Top Contributors

[![swuppio](https://avatars.githubusercontent.com/u/5064525?v=4)](https://github.com/swuppio "swuppio (2 commits)")

---

Tags

random sting generatorrandom stingrandom password

### Embed Badge

![Health badge](/badges/swuppio-randstring/health.svg)

```
[![Health](https://phpackages.com/badges/swuppio-randstring/health.svg)](https://phpackages.com/packages/swuppio-randstring)
```

###  Alternatives

[mage2tv/magento-cache-clean

This package has been migrated to mage-os/magento-cache-clean. Please switch over at your convenience.

5432.2M3](/packages/mage2tv-magento-cache-clean)[torann/currency

This provides Laravel with currency functions such as currency formatting and conversion using up-to-date exchange rates.

4031.1M6](/packages/torann-currency)[diff/diff

Small standalone library for representing differences between data structures, computing such differences, and applying them as patches

2031.7M14](/packages/diff-diff)[kartik-v/bootstrap-checkbox-x

An extended checkbox plugin for bootstrap with three states and additional styles.

911.1M1](/packages/kartik-v-bootstrap-checkbox-x)

PHPackages © 2026

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