No description
Find a file
2026-04-23 11:40:34 +02:00
src refs #1: Implemented symbols and ensure that all selected types are present in generated string 2026-04-23 11:36:23 +02:00
tests refs #1: Implemented symbols and ensure that all selected types are present in generated string 2026-04-23 11:36:23 +02:00
.gitignore Updating library with a few improvements. 2025-09-06 19:22:48 +02:00
codeception.yml Updating library with a few improvements. 2025-09-06 19:22:48 +02:00
composer.json Updating library with a few improvements. 2025-09-06 19:22:48 +02:00
README.md Update README.md 2026-04-23 11:40:34 +02:00

Random

It is a simple class to generate random alpha numeric strings to generate things like apikeys, passwords or recovery codes.

Install

composer require iwalkalone/random

How to use it

\iwalkalone\Random::generate($length, $type);

Example:

\iwalkalone\Random::generate(12, 'Aans');

Allowed types are:

  • n: only numbers (0-9).
  • A: only capital letters (A-Z).
  • a: only lowercase letters (a-z).
  • s: symbols (.,_#@-).

Note that if letters are combined with numbers some of letters and numbers are dropeed to avoid confusion.

By default, length is 8 and type is Aan.