PHPackages                             hamidgh83/url\_shortner - 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. [Security](/categories/security)
4. /
5. hamidgh83/url\_shortner

ActiveLibrary[Security](/categories/security)

hamidgh83/url\_shortner
=======================

URL shortener Base-X encoder/decoder

v1.0.0(6y ago)08MITPHPPHP &gt;=5.6

Since Oct 10Pushed 5y ago1 watchersCompare

[ Source](https://github.com/hamidgh83/url_shortner)[ Packagist](https://packagist.org/packages/hamidgh83/url_shortner)[ RSS](/packages/hamidgh83-url-shortner/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

### The package

[](#the-package)

[![Latest Stable Version](https://camo.githubusercontent.com/ad882e631122e0f53bbc86f573c0bf97947073c7f49bec8241d7f132b833ec2e/68747470733a2f2f706f7365722e707567782e6f72672f68616d6964676838332f75726c5f73686f72746e65722f76)](//packagist.org/packages/hamidgh83/url_shortner)[![Total Downloads](https://camo.githubusercontent.com/8da6431a6334b3c0294c50ec92f8c2454eb2bf48a6d1a5539de5a07e12e797df/68747470733a2f2f706f7365722e707567782e6f72672f68616d6964676838332f75726c5f73686f72746e65722f646f776e6c6f616473)](//packagist.org/packages/hamidgh83/url_shortner)[![Dependents](https://camo.githubusercontent.com/c43178e87c7909caeeee69fd5c8cf6ee00f314b5287e78e29681b59ce3c6532b/68747470733a2f2f706f7365722e707567782e6f72672f68616d6964676838332f75726c5f73686f72746e65722f646570656e64656e7473)](//packagist.org/packages/hamidgh83/url_shortner)[![License](https://camo.githubusercontent.com/d66f7b6170a404c2d75cb05c64b99da8c4447b959791bfaa7308dade6290330f/68747470733a2f2f706f7365722e707567782e6f72672f68616d6964676838332f75726c5f73686f72746e65722f6c6963656e7365)](//packagist.org/packages/hamidgh83/url_shortner)

URL shortener Base-X encoder/decoder
====================================

[](#url-shortener-base-x-encoderdecoder)

This is a general purpose library to encode/decode an integer number. Given a string of valid alphabets you can encode your number into a small string.

A possible use case of this library is to use it as a url shortner. Just get the corresponding id of the url (from database) and encode it through this library. In this way you don't need to store the hash value in the DB and you will be able to change your encryption algorithm at any time.

### Possible use cases

[](#possible-use-cases)

- Shorten URLs
- Two way comunication
- Hash generation
- ...

### Examples

[](#examples)

**Example 1)**

```
$num = 98201564;

$shotrner = new Shortner;
$encodedStr = $shotrner->encode($num);
echo $encodedStr;

$decodedStr = $shotrner->decode($encodedStr);
echo "\n" . $encodedStr;

```

Outputs:

```
gOcSm
98201564

```

**Example 2)**

```
$alphabets = "abcdefghijklmnopqrstuvwxyz";
$num = 98201564;

$shotrner = new Shortner($alphabets);
$encodedStr = $shotrner->encode($num);
echo $encodedStr;

$decodedStr = $shotrner->decode($encodedStr);
echo "\n" . $encodedStr;

```

Outputs:

```
igxgpg
98201564

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

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

2403d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4dedaadbfaf607c33c4b02a55eb9e3a4cf5407267d99d4b4eb7b3fe4a4f1e327?d=identicon)[hamidgh83](/maintainers/hamidgh83)

---

Top Contributors

[![hamidgh83](https://avatars.githubusercontent.com/u/3264788?v=4)](https://github.com/hamidgh83 "hamidgh83 (7 commits)")[![hamidghorashi](https://avatars.githubusercontent.com/u/89512189?v=4)](https://github.com/hamidghorashi "hamidghorashi (2 commits)")

---

Tags

bijective-mapsdecryptionencoderencryptionshortnerurl

### Embed Badge

![Health badge](/badges/hamidgh83-url-shortner/health.svg)

```
[![Health](https://phpackages.com/badges/hamidgh83-url-shortner/health.svg)](https://phpackages.com/packages/hamidgh83-url-shortner)
```

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M212](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M112](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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