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 today

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

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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

861d 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

[mark-gerarts/auto-mapper-plus

An AutoMapper for PHP

5623.5M23](/packages/mark-gerarts-auto-mapper-plus)[veewee/composer-run-parallel

Run composer tasks in parallel

92810.6k20](/packages/veewee-composer-run-parallel)[supervisorphp/configuration

Manage Supervisor configuration in PHP

39614.9k4](/packages/supervisorphp-configuration)[element119/module-custom-admin-logo

A Magento 2 module that allows admins to set the logo for their admin panel and login screen.

155.2k](/packages/element119-module-custom-admin-logo)

PHPackages © 2026

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