PHPackages                             wllcdev/arda-tokens - 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. wllcdev/arda-tokens

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

wllcdev/arda-tokens
===================

Generate memorable token names with Tolkien's Legendarium theme

v1.0.3(3mo ago)314MITPHPPHP ^8.3CI passing

Since Jan 24Pushed 3mo agoCompare

[ Source](https://github.com/wllcdev/arda-tokens)[ Packagist](https://packagist.org/packages/wllcdev/arda-tokens)[ Docs](https://github.com/wllcdev/arda-tokens)[ RSS](/packages/wllcdev-arda-tokens/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

 [![Arda Tokens](https://repository-images.githubusercontent.com/1140927461/790783ac-48e2-4400-b0cc-298a4de73a20)](https://repository-images.githubusercontent.com/1140927461/790783ac-48e2-4400-b0cc-298a4de73a20)

 [![CI](https://github.com/wllcdev/arda-tokens/actions/workflows/ci.yml/badge.svg)](https://github.com/wllcdev/arda-tokens/actions/workflows/ci.yml) [![Latest Version on Packagist](https://camo.githubusercontent.com/458ff3f25894cd25c5750acf9f65b8b3982555d985d547d7f8b5ef6a12d47c6c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776c6c636465762f617264612d746f6b656e732e737667)](https://packagist.org/packages/wllcdev/arda-tokens) [![PHP Version](https://camo.githubusercontent.com/0a079b2c8b0f9b828af47b3aec16953bf0d03b5b3a140bcc4ca1272f6644ad1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f776c6c636465762f617264612d746f6b656e732e737667)](https://packagist.org/packages/wllcdev/arda-tokens) [![License](https://camo.githubusercontent.com/32ed45da32123dc518e31ed826b586cbfb3d145da35eae1edf9e26897ae5e539/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f776c6c636465762f617264612d746f6b656e732e737667)](https://packagist.org/packages/wllcdev/arda-tokens)

> *"Not all who wander are lost"* - but all who need tokens shall find them here.

Generate memorable, human-readable token names inspired by Tolkien's Legendarium. Perfect for friendly resource identifiers, human-readable labels, memorable names for non-security-critical purposes, or any scenario where you need unique names that are easy to read and remember.

Why Arda Tokens?
----------------

[](#why-arda-tokens)

- **Memorable**: `elvish-gandalf` is easier to remember than `a7b2c9d4e5f6`
- **Readable**: Easy to communicate verbally or spot in logs
- **Unique**: Up to 825+ million combinations with hex suffixes
- **Secure**: Uses `random_int()` and `random_bytes()` for cryptographically secure randomness
- **Simple**: One static class, zero dependencies, zero configuration

Requirements
------------

[](#requirements)

- PHP 8.3 or higher

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

[](#installation)

```
composer require wllcdev/arda-tokens
```

Quick Start
-----------

[](#quick-start)

```
use Wllcdev\ArdaTokens\Arda;

// Generate a token
$token = Arda::token();  // "precious-frodo"
```

That's it! No configuration needed.

Usage
-----

[](#usage)

### Generating Tokens

[](#generating-tokens)

```
use Wllcdev\ArdaTokens\Arda;

// Default: no suffix
Arda::generate();     // "elvish-gandalf"
Arda::token();        // "hobbitish-shire" (alias)

// With suffix (1-4 characters)
Arda::generate(1);    // "golden-ring-f"
Arda::generate(2);    // "shadowy-mordor-4e"
Arda::generate(3);    // "mithril-aragorn-a3f"
Arda::generate(4);    // "starlit-galadriel-8f2a" (max)

// Invalid suffix length throws exception
Arda::generate(5);    // InvalidArgumentException
Arda::generate(-1);   // InvalidArgumentException
```

### Checking Capacity

[](#checking-capacity)

Calculate how many unique tokens can be generated:

```
use Wllcdev\ArdaTokens\Arda;

// Base capacity (no suffix)
Arda::capacity();              // 12,600
Arda::capacityWithSuffix(0);   // 12,600 (same as capacity())

// With hex suffix
Arda::capacityWithSuffix(1);   // 201,600
Arda::capacityWithSuffix(2);   // 3,225,600
Arda::capacityWithSuffix(3);   // 51,609,600
Arda::capacityWithSuffix(4);   // 825,753,600
```

Token Format
------------

[](#token-format)

Tokens follow the pattern: `{adjective}-{noun}[-{hex}]`

Suffix LengthExampleUnique Combinations0 (default)`precious-ring`12,6001`elvish-frodo-a`201,6002`mithril-gandalf-3f`3,225,6003`hobbitish-shire-a2b`51,609,6004 (max)`ancient-mordor-f3a1`825,753,600Security Considerations
-----------------------

[](#security-considerations)

This package generates **human-readable token names** and is designed for:

- Friendly identifiers for API tokens
- Memorable names for resources
- Human-readable labels
- Non-security-critical naming

**This package is NOT suitable for:**

- Session IDs (use PHP's [`session_regenerate_id()`](https://www.php.net/manual/en/function.session-regenerate-id.php))
- Authentication tokens (use [`random_bytes()`](https://www.php.net/manual/en/function.random-bytes.php) or dedicated libraries)
- CSRF tokens (use framework-provided CSRF protection)
- Password reset tokens
- Any security-critical random values

### Why?

[](#why)

The maximum entropy provided is ~30 bits (with 4-char suffix), which is below the [OWASP-recommended minimum of 64 bits](https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html#session-id-entropy) for security-sensitive applications.

Suffix LengthUnique CombinationsEntropy (bits)0 (default)12,600~13.61201,600~17.623,225,600~21.6351,609,600~25.64 (max)825,753,600~29.6### What Makes It Secure for Its Purpose?

[](#what-makes-it-secure-for-its-purpose)

- Uses PHP's cryptographically secure [`random_int()`](https://www.php.net/manual/en/function.random-int.php) and [`random_bytes()`](https://www.php.net/manual/en/function.random-bytes.php)
- Follows [OWASP recommendations](https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html#secure-random-number-generation) for secure random number generation
- No sensitive information embedded in tokens

API Reference
-------------

[](#api-reference)

### `Arda::generate(int $suffixLength = 0): string`

[](#ardagenerateint-suffixlength--0-string)

Generates a random token name.

ParameterTypeDefaultDescription`$suffixLength``int``0`Length of hex suffix (0-4).**Returns**: `string` - The generated token name.

**Throws**:

- `InvalidArgumentException` if `$suffixLength` is not between 0 and 4.
- `RuntimeException` if secure random generation fails.

### `Arda::token(int $suffixLength = 0): string`

[](#ardatokenint-suffixlength--0-string)

Alias of `generate()`.

### `Arda::capacity(): int`

[](#ardacapacity-int)

Returns the total number of unique combinations without a hex suffix.

**Returns**: `int` - Number of unique adjective-noun combinations (12,600).

### `Arda::capacityWithSuffix(int $suffixLength = 3): int`

[](#ardacapacitywithsuffixint-suffixlength--3-int)

Returns the total number of unique combinations with a hex suffix.

ParameterTypeDefaultDescription`$suffixLength``int``3`Length of hex suffix (0-4).**Returns**: `int` - Total unique combinations. Returns same as `capacity()` when `$suffixLength` is 0.

**Throws**: `InvalidArgumentException` if `$suffixLength` is not between 0 and 4.

Word Lists
----------

[](#word-lists)

The generator includes 90 adjectives and 140 nouns from Tolkien's Legendarium:

**Adjectives**: precious, elvish, mithril, hobbitish, dwarven, entish, rohirric, gondorian, starlit, moonlit, shadowy, ancient, forgotten, blessed, cursed, hidden, wandering, faithful, valiant...

**Nouns**:

- **Characters**: frodo, gandalf, aragorn, legolas, gimli, gollum, bilbo, arwen, galadriel, elrond, saruman, sauron...
- **Creatures**: hobbit, balrog, nazgul, ent, orc, eagle, shelob, smaug, warg, dragon...
- **Places**: shire, mordor, gondor, rohan, rivendell, lothlorien, moria, isengard, mirkwood, erebor...
- **Objects**: ring, palantir, silmaril, sting, anduril, phial, lembas, pipeweed...
- **Concepts**: fellowship, quest, journey, adventure, doom, hope, shadow, flame...

Development
-----------

[](#development)

This project uses [DevContainers](https://containers.dev/) for development.

### Getting Started

[](#getting-started)

1. Clone the repository
2. Open in VS Code (or any DevContainer-compatible editor)
3. Reopen in Container when prompted
4. Dependencies will be installed automatically

### Commands

[](#commands)

```
# Run tests
composer test

# Check code style
composer lint:check

# Fix code style
composer lint

# Run static analysis
composer analyse
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

41

—

FairBetter than 88% of packages

Maintenance86

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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

Every ~0 days

Total

4

Last Release

105d ago

### Community

Maintainers

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

---

Top Contributors

[![andradewall](https://avatars.githubusercontent.com/u/14243337?v=4)](https://github.com/andradewall "andradewall (5 commits)")

---

Tags

generatortokenlotrtolkienmiddle-earth

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/wllcdev-arda-tokens/health.svg)

```
[![Health](https://phpackages.com/badges/wllcdev-arda-tokens/health.svg)](https://phpackages.com/packages/wllcdev-arda-tokens)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M563](/packages/symfony-maker-bundle)[simplesoftwareio/simple-qrcode

Simple QrCode is a QR code generator made for Laravel.

2.9k27.6M91](/packages/simplesoftwareio-simple-qrcode)

PHPackages © 2026

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