PHPackages                             gsylvestre/php-token-generator - 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. gsylvestre/php-token-generator

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

gsylvestre/php-token-generator
==============================

Generate crypto-secure URL safe strings

v0.1(6y ago)137301[1 PRs](https://github.com/gsylvestre/php-token-generator/pulls)MITPHPPHP ^7.0CI failing

Since Dec 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/gsylvestre/php-token-generator)[ Packagist](https://packagist.org/packages/gsylvestre/php-token-generator)[ RSS](/packages/gsylvestre-php-token-generator/feed)WikiDiscussions master Synced 1w ago

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

PHP Token Generator
-------------------

[](#php-token-generator)

Simple yet secure token generator for PHP7.

- Crypto-secure
- Strings can be used in URLs
- Optionnaly remove similar characters (Il1 and 0oO)
- You choose the returned string length

### Installation

[](#installation)

```
composer require gsylvestre/php-token-generator
```

### Usage

[](#usage)

```
$generator = new \PHPTokenGenerator\TokenGenerator();
$token = $generator->generate(24); //RDTAwiMFSZiTs5y3Eqq7b9ud
```

#### Other usages

[](#other-usages)

Default string length is 32:

```
$generator = new \PHPTokenGenerator\TokenGenerator();
$token = $generator->generate(); //MpWUMGLUeg6FQQr6CHi7S8n9tfapY2bc
```

By default, the characters `Il10oO` are removed from returned string (because they look alike and cause errors when human reading is required). You can still get them by passing `false` as second argument :

```
$generator = new \PHPTokenGenerator\TokenGenerator();
$token = $generator->generate(12, false); //9tIKdlfCSOo4
```

### License

[](#license)

MIT

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community8

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

2353d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

phpstringcryptogeneratortoken

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gsylvestre-php-token-generator/health.svg)

```
[![Health](https://phpackages.com/badges/gsylvestre-php-token-generator/health.svg)](https://phpackages.com/packages/gsylvestre-php-token-generator)
```

###  Alternatives

[coduo/php-to-string

Simple library that converts PHP value into strings

27112.7M10](/packages/coduo-php-to-string)[sinergi/token

PHP library to generate random strings

188.7k9](/packages/sinergi-token)[andrewcarteruk/cryptokey

A command line tool for generating keys using a CSPRNG.

6124.2k](/packages/andrewcarteruk-cryptokey)[tomloprod/radiance

A deterministic mesh gradient avatar generator for PHP.

1393.7k](/packages/tomloprod-radiance)

PHPackages © 2026

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