PHPackages                             sonypradana/convertcode - 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. sonypradana/convertcode

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

sonypradana/convertcode
=======================

Simple generator to creat uniq id from number and convert back to number/id

v0.9.0(5y ago)32.0k↓90%2[1 issues](https://github.com/SonyPradana/ConvertCode/issues)[1 PRs](https://github.com/SonyPradana/ConvertCode/pulls)PHPPHP ^5.3.3 || ^7.0 || ^8.0CI failing

Since Dec 3Pushed 4y ago1 watchersCompare

[ Source](https://github.com/SonyPradana/ConvertCode)[ Packagist](https://packagist.org/packages/sonypradana/convertcode)[ RSS](/packages/sonypradana-convertcode/feed)WikiDiscussions master Synced 2w ago

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

ConvertCode
===========

[](#convertcode)

Simple script to creat uniq id from number, support until up to **11.694.146.092.834.141** digit number. With suport convert back to id (string).

We recommended if you need shorter id from long number ex: timestamp, id with large integer, or name think.

Basic convert is creat id from array of string, then build from array index one by one. You can costumize by edit entry of array.

By default array using \[0-9\]\[a-z\]\[A-Z\] its mean case sensitive. different between AA and aA

### Sample

[](#sample)

```
-------------------------------------------------
|       index   |       code    |       number  |
----------------+---------------+----------------
|       94      |       0w      |       94      |
|       95      |       0x      |       95      |
|       96      |       0y      |       96      |
|       ...     |       ...     |       ...     |
|       3842    |       YY      |       3842    |
|       3843    |       YZ      |       3843    |
|       3844    |       Z0      |       3844    |
|       ...     |       ...     |       ...     |
|       238323  |       ZYV     |       238323  |
|       238324  |       ZYW     |       238324  |
|       238325  |       ZYX     |       238325  |
-------------------------------------------------

```

### CLI Support

[](#cli-support)

run test from 1 to 100

```
php CLI test 1 100
```

will output

```
-------------------------------------------------
|       index   |       code    |       number  |
----------------+---------------+----------------
|       1       |       1       |       1       |
|       2       |       2       |       2       |
|       3       |       3       |       3       |
|       4       |       4       |       4       |
|       5       |       5       |       5       |
...
|       95      |       0x      |       95      |
|       96      |       0y      |       96      |
|       97      |       0z      |       97      |
|       98      |       0A      |       98      |
|       99      |       0B      |       99      |
|       100     |       0C      |       100     |
-------------------------------------------------
```

other command

```
php CLI
php CLI to-code [number]
php CLI from-code [string_code]
```

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

[](#installation)

You can directly import this class from your project.

```
include 'path_to_ConvertCode_file' . '/ConvertCode.php';
```

If using [Composer](https://getcomposer.org/)

```
composer require sonypradana/convertcode;
```

Usage
-----

[](#usage)

You can make id using declare class or directly.

### Using class:

[](#using-class)

Craet class

```
use Convert\Converter\ConvertCode;

$ccode = new ConvertCode();
```

Creat id (string) from number

```
$ccode->setNumber( 999999 );  // creat id by 99
echo $ccode->getCode();       // will out put -> 4c81
```

Creat id (string) from id/code/string

```
$ccode->setCode( '4c82' );  // creat id by code "4c82"
echo $ccode->getNumber();   // will out put -> 1000000
```

You can also using operator

```
// plus (+) operator
$ccode->plusOperator(1);    // plus 1
echo $ccode->getNumber();   // will out put -> 1000001
echo $ccode->getCode();     // will out put -> ac83

// minus (-) operator
$ccode->minusOperator(2);    // minus 2
echo $ccode->getNumber();   // will out put -> 999999
echo $ccode->getCode();     // will out put -> ac81
```

### Directly

[](#directly)

You also can call function directly

Convert from **id/code/string** to **number**

```
use ConvertCode\Converter\ConvertCode;

$id_number = ConvertCode::ConvertFromCode( "0B" );
echo $id_number; // will out put 99
```

Convert from **number** to **id/code/string**

```
use ConvertCode\Converter\ConvertCode;

$id_code = ConvertCode::ConvertFromNumber( 99 );
echo $id_code; // will out put "0B"
```

If you want to get random **id/code/string**, you can use

```
use ConvertCode\Converter\ConvertCode;

$id_code = ConvertCode::RandomCode( 4 ); // how many digit code you want
echo $id_code; // random code
```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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

2027d ago

### Community

Maintainers

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

---

Top Contributors

[![SonyPradana](https://avatars.githubusercontent.com/u/7188706?v=4)](https://github.com/SonyPradana "SonyPradana (7 commits)")

---

Tags

phpuniq idreversible id

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sonypradana-convertcode/health.svg)

```
[![Health](https://phpackages.com/badges/sonypradana-convertcode/health.svg)](https://phpackages.com/packages/sonypradana-convertcode)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21422.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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