PHPackages                             ajepe/base62 - 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. ajepe/base62

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

ajepe/base62
============

base62 encode integer as a string and decode the string back to an integer

08PHP

Since Jul 18Pushed 7y ago1 watchersCompare

[ Source](https://github.com/ajepe/base62)[ Packagist](https://packagist.org/packages/ajepe/base62)[ RSS](/packages/ajepe-base62/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/681322246126a0d6dc3ec3b6f97b672dcf52d8803b17d3199af1c82d10f2802b/68747470733a2f2f7472617669732d63692e6f72672f616a6570652f6261736536322e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ajepe/base62)

BASE62
------

[](#base62)

Base is a small package that encodes integer to a string and decodes the same string back to an integer, this is can useful in making URL shortening application or generating unique URL slug. It convert the **int** id to base 62 characters with the encode method and converts it back to an integer with the decode public method.

- It converts non-negative integer number like *42000000* up to *PHP\_INT\_SIZE* of the platform in which the package is being use on into a string like *2Qe7m*. The action is reversible.
- It can also decode the id back from *2Qe7m* to *42000000*.
- This is useful in youtube like url or simply using them making url shortening website.

### Install

[](#install)

Via Composer

```
composer require ajepe/base62:0.0.2
```

### Usage

[](#usage)

```
require 'vendor/autoload.php';

$encode = new Base\Encode();
$decode = new Base\Decode();
$encode = $encode->encode(PHP_INT_MAX); //return HXy0p9
$decode = $decode->decode($encode); // return 24815682095
printf('The encode value of %s map directly to %s', $encode, $decode);
```

[README.md](README.md), [CHANGELOG.md](CHANGELOG.md), [CONTRIBUTING.md](CONTRIBUTING.md), [LICENSE.txt](LICENSE) and [composer.json](composer.json)

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/50893eba1a66ece9339e5103fb941d0e9d3a46f4cf866694be7b342e7ef53ce0?d=identicon)[ajepe](/maintainers/ajepe)

---

Top Contributors

[![ajepe](https://avatars.githubusercontent.com/u/19615837?v=4)](https://github.com/ajepe "ajepe (13 commits)")

---

Tags

base62decoderencoder

### Embed Badge

![Health badge](/badges/ajepe-base62/health.svg)

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

###  Alternatives

[jcbrand/converse.js

Browser based XMPP instant messaging client

3.2k156.6k](/packages/jcbrand-conversejs)[pastuhov/yii2-yml-catalog

YML (Yandex Market Language) generator.

2116.7k](/packages/pastuhov-yii2-yml-catalog)[flagbit/table-attribute-bundle

The Flagbit Table Attribute Bundle for Akeneo PIM gives you the possibility to enrich your product with multi-dimensional data presentation in the form of tables, allowing you maximum flexibility within the PIM.

2310.4k](/packages/flagbit-table-attribute-bundle)[mirazmac/bangla-string

A wannabe all-in-all Bangla String Manupulation Library!

103.0k](/packages/mirazmac-bangla-string)

PHPackages © 2026

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