PHPackages                             mpsoft-digital/keygen - 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. mpsoft-digital/keygen

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

mpsoft-digital/keygen
=====================

Pattern-based key generator

1.2.5(2y ago)061.2k—0%MITPHPPHP ^7.4|^8.0

Since Jul 19Pushed 2y agoCompare

[ Source](https://github.com/mpsoft-digital/keygen-package)[ Packagist](https://packagist.org/packages/mpsoft-digital/keygen)[ RSS](/packages/mpsoft-digital-keygen/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Keygen
======

[](#keygen)

[![](https://camo.githubusercontent.com/b87d10645af9958c422fe8c5b4a3533ec370f8a522c48cce63548155bc4ec994/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b61696f70696f6c612f6b657967656e3f636f6c6f723d2532333030464646)](https://packagist.org/packages/kaiopiola/keygen)[![](https://camo.githubusercontent.com/93a243c6e2a1e27ab09ece91881c43740a0c91a799e83669c3309b148d09851a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61696f70696f6c612f6b657967656e3f636f6c6f723d253233383838383838266c6162656c3d76657273696f6e)](https://packagist.org/packages/kaiopiola/keygen)[![](https://camo.githubusercontent.com/25b3947eeb95cc8022ca1f242b9f7a0a364cb3b9e166aca89437fdea9326ed5e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6b61696f70696f6c612f6b657967656e)](https://packagist.org/packages/kaiopiola/keygen)

### Essa documentação está disponível também em [Português do Brasil](README_pt-BR.MD).

[](#essa-documentação-está-disponível-também-em-português-do-brasil)

***This plugin is under development and may exhibit unexpected behavior while using it, please report any bugs or errors you find when using this solution, so that we can make it the best possible for your use!***

The Keygen plugin is a key or serial generator based on user-defined mask patterns. The plugin is able to generate keys like the example below:

`6W2F-4RJB-KV0Z-ADA6-4SJ2`

It can be used to generate keys for several purposes, some examples are:

- Unique links to reset passwords
- Registration via invitation link
- Two-Factor authentication codes
- File sharing links
- Product redemption keys
- Discount coupons
- Referral codes

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

[](#installation)

Fisrt, run the following command in your project:

```
composer require kaiopiola/keygen
```

Then, call the main class on the PHP file you want to load it:

```
use Kaiopiola\Keygen\Key;
```

How Keygen works
----------------

[](#how-keygen-works)

### How to create a new key

[](#how-to-create-a-new-key)

To create a new key, just instantiate the class in a variable, and then define its configuration parameters, as shown in the example below:

```
# Instantiating class in a variable:
$exampleKey = new Key;

# Setting parameters:
$exampleKey->setPattern("XXXX-NNNN-LLLL"); // Defines the pattern that the code will use to define its new key.
// The letters represent the type of content that can be used in that space, as per the rule:
// X - Any letter or number
// N - Numbers only as defined
// L - Letters only as defined
// Any other characters like dashes, dots, slashes, and even other letters and numbers, will not be replaced.
// If this property is not defined, the following will be used by default: XXXXX-XXXXX-XXXXX

$exampleKey->setNumbers("789"); // Defines the numbers that can compose your key, if not defined, it will use by default "0123456789"
$exampleKey->setLetters("ABC"); // Defines the letters that can compose your key, if not defined, it will use by default "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

$exampleKey->generate(); // Generate your key and return a string value with the result
```

### How to create a new unique key

[](#how-to-create-a-new-unique-key)

⚠️ *This particular feature is still under development and you may experience issues or instability when using it!
If you find any problems or bugs, please [create a new issue](https://github.com/kaiopiola/keygen-package/issues/new?labels=bug) tagged bug!* ⚠️

You also have the option to generate an unique key to avoid duplicates, using the example below:

```
$exampleKey->setExistingKeys([]); // Defines the existing keys that the code will avoid duplicates. Must be type array.

$exampleKey->generateUnique(); // Generate your key and return a string value with the result
```

This is also compatible with `setPattern`, `setNumbers` and `setLetters` too!

Considerations
--------------

[](#considerations)

This project is open to contributions, whether with suggestions or improvements to the code of any kind. Feel free to participate in its development.

License
-------

[](#license)

MIT License (MIT). Please, read the [License File](LICENSE) for more informations.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.9% 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

1026d ago

### Community

Maintainers

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

---

Top Contributors

[![kaiopiola](https://avatars.githubusercontent.com/u/35163593?v=4)](https://github.com/kaiopiola "kaiopiola (29 commits)")[![ordago](https://avatars.githubusercontent.com/u/6376814?v=4)](https://github.com/ordago "ordago (3 commits)")[![kaiompsoft](https://avatars.githubusercontent.com/u/85122219?v=4)](https://github.com/kaiompsoft "kaiompsoft (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mpsoft-digital-keygen/health.svg)

```
[![Health](https://phpackages.com/badges/mpsoft-digital-keygen/health.svg)](https://phpackages.com/packages/mpsoft-digital-keygen)
```

###  Alternatives

[lexxyungcarter/chatmessenger

Simple one-to-one/group chat messaging tool for Laravel 5, 6, 7, 8, 9 &amp; 10 with Pusher Integration

10724.1k](/packages/lexxyungcarter-chatmessenger)[georgeboot/laravel-tiptap

Opinionated integration of Tiptap editor using the TALL stack

346.4k](/packages/georgeboot-laravel-tiptap)[bmichotte/dijkstra

php 7+ implementation of the Dijkstra algorithm

131.5k](/packages/bmichotte-dijkstra)

PHPackages © 2026

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