PHPackages                             ngubin/key-n - 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. ngubin/key-n

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

ngubin/key-n
============

Generation a unique short key from the number.

v1.0(5y ago)09MITPHPPHP &gt;=7.2CI failing

Since Jul 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ngubin/key-n)[ Packagist](https://packagist.org/packages/ngubin/key-n)[ RSS](/packages/ngubin-key-n/feed)WikiDiscussions master Synced today

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

KeyN
====

[](#keyn)

Generating a unique short key from the number.

A simple library for converting a number into a string key and back. You can use to shorten long numbers to unique keys.

[![Latest Version](https://camo.githubusercontent.com/a3b1aeb72324f34430ffdb3101d0173aa29aac035b7c172490d2b5c725f81df3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6e677562696e2f6b65792d6e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/ngubin/key-n/releases)[![Total Downloads](https://camo.githubusercontent.com/9f8bdb0b7218740fce716cff6ee8b170abb0eec3fd6dc3849a2b49063969b0ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e677562696e2f6b65792d6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ngubin/key-n)

Example Usage
-------------

[](#example-usage)

#### Creating a key from a number:

[](#creating-a-key-from-a-number)

You can only encode an integer greater than or equal to one.

```
use KeyN\Make\Key62;

$instance = Key62::make();
$key = $instance->encode(100000);
```

#### Set your own character set to create keys:

[](#set-your-own-character-set-to-create-keys)

```
use KeyN\Make\Key62;

$characters = 'wWpJbH8nIDed1Evq5OcToF2ZuXsayz7RrtP490ixSKC3GM6gYkNVhBUQmLlfAj';

$instance = Key62::make($characters);
$key = $instance->encode(100000);
```

#### Getting the number from the key:

[](#getting-the-number-from-the-key)

You can decode the key if all of its characters are in the class set.

```
use KeyN\Make\Key62;

$instance = Key62::make();
$number = $instance->decode('Gh1a');
```

License
-------

[](#license)

This project is released under the MIT License.

© 2020 Nik Gubin, All rights reserved.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

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

Unknown

Total

1

Last Release

2184d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1e0e135232c67517951b75551466bb29debb2f1696abb79c8c7a8e2f70bd1b26?d=identicon)[LabiisDevelopment](/maintainers/LabiisDevelopment)

---

Top Contributors

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

---

Tags

packagedecimalkeybinaryshorthexadecimaloctal

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ngubin-key-n/health.svg)

```
[![Health](https://phpackages.com/badges/ngubin-key-n/health.svg)](https://phpackages.com/packages/ngubin-key-n)
```

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k196.2M3.1k](/packages/composer-composer)[brick/math

Arbitrary-precision arithmetic library

2.2k548.2M419](/packages/brick-math)[jean85/pretty-package-versions

A library to get pretty versions strings of installed dependencies

1.3k315.9M83](/packages/jean85-pretty-package-versions)[shivella/laravel-bitly

Laravel package for generating bitly url

75867.0k1](/packages/shivella-laravel-bitly)[delight-im/base-convert

Conversion of arbitrarily large numbers between any two bases or alphabets

171.5k](/packages/delight-im-base-convert)[nelexa/buffer

Reading And Writing Binary Data (incl. primitive types, ex. byte, ubyte, short, ushort, int, uint, long, float, double). The classes also help with porting the I/O operations of the JAVA code.

33527.5k5](/packages/nelexa-buffer)

PHPackages © 2026

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