PHPackages                             skyleaf/cellular-identifier - 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. skyleaf/cellular-identifier

ActiveLibrary

skyleaf/cellular-identifier
===========================

Converts cellular device identifiers between different specifications and formats.

1.0.2(10y ago)018MITPHPPHP &gt;=5.3.0

Since Feb 25Pushed 10y ago1 watchersCompare

[ Source](https://github.com/raphaeltraviss/CellularIdentifier)[ Packagist](https://packagist.org/packages/skyleaf/cellular-identifier)[ RSS](/packages/skyleaf-cellular-identifier/feed)WikiDiscussions 1.x Synced 2mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

[![Build Status](https://camo.githubusercontent.com/b21fb0f07f061984925a830d9266dce59606167da8258805a3e49fa82a328974/68747470733a2f2f7472617669732d63692e6f72672f7261706861656c747261766973732f43656c6c756c61724964656e7469666965722e7376673f6272616e63683d312e78)](https://travis-ci.org/raphaeltraviss/CellularIdentifier)

Why does this exist?
====================

[](#why-does-this-exist)

Device identifiers from cellular equipment can have many different formats and follow multiple specifications. Therefore, the same device can be referenced by many different device identifiers, which is a problem, because cellular serial numbers are often used as unique identifiers.

This class will allow you to convert a cellular device identification number from one format to another (hex to dec and vice-versa), and from one specification to another (e.g. from MEID to pseudo ESN).

If any additional mobile identifier specifications and formats appear in the future, this class can easily be amended to include them.

How do I use this?
==================

[](#how-do-i-use-this)

#### Checking if a given identifier is valid:

[](#checking-if-a-given-identifier-is-valid)

```
  $identifier = new CellularIdentifier('A1000001FFFFFF');

  if($identifier) {
    // Iterate over identifier results.
  } else {
    // Do error handling.
  }
```

#### Converting between formats; returning a single value:

[](#converting-between-formats-returning-a-single-value)

```
  $identifier = new CellularIdentifier('123456789012345678');
  if ($identifier) {
    $identifier->specification(); // 'meid'
    $identifier->format(); // '10'

    $pseudo_esn = $identifier->hex()->esn()->value(); // '80FFFFFF'
    $identifier->specification(); // 'esn'
    $identifier->format(); // '16'

    // You could have also done $identifier->esn()->hex()->value().
  }
```

#### Converting between many formats; returning many values:

[](#converting-between-many-formats-returning-many-values)

```
  $identifier = new CellularIdentifier('99990000000000');

  if ($identifier) {
    // Do as many conversions as you want.
    $identifier->hex()->dec()->esn()->hex()->dec();

    // Only the valid spec/format values for the given identifier will be non-null.
    foreach ($identifier as $specification_and_format => $value) {
      if (isset($value)) {
        print $specification_and_format . $value . "\n";
      }
    }
  }
```

#### Calculating a check digit:

[](#calculating-a-check-digit)

```
  $identifier = new CellularIdentifier('99990000000001');

  if ($identifier) {
    $check_digit = $identifier->checkDigit();
  }
```

How does this class work?
=========================

[](#how-does-this-class-work)

1. A regex determines the specification and format of the given identifier.
2. Values from the given identifier are cached.
3. Transformation methods are called on the identifier object.
4. A transformation function is retrieved from an array
5. The transformation function is applied to the identfier object.
6. The returned value of the transformation function is cached.
7. The internal state of the object changes to reflect the most recent transformation.

Since *so many* strings are being used to reference transformation functions and cached values, you will notice liberal use of `AbstractClass::someconstant`. This is to reduce runtime errors for mis-typing strings, and also serves as a conceptual model which says, "These are specifications and formats, not just strings of characters." Using abstract class constants is the simplest way to mimic an `enum` in PHP.

Also, you will notice we had to take liberties to make this class work in PHP 5.3, which has some minor array key and closure deficiencies.

Limitations
===========

[](#limitations)

#### All-decimal MEID inputs

[](#all-decimal-meid-inputs)

There is some confusion between MEID and IMEI. Some devices, such as Motorola world phones, have two separate radios; in which case, the IMEI and MEID will have nothing to do with each other. Some devices, such as the Apple iPhone, use the IMEI as an MEID. For calculation purposes, IMEI are base-10, and MEID are base-16; which means that the check digit calculation for an all-decimal IMEI (base-10) and an all-decimal MEID (base-16) will be different, even though they contain the same decimal digits. Therefore, if you instantiate a CellularIdentifier object with an all-decimal pattern that could be either an IMEI or an MEID, we assume that the pattern in an IMEI.

#### Check digit calculations

[](#check-digit-calculations)

Only check digit calculations for decimal IMEIs are supported.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~11 days

Total

4

Last Release

3695d ago

### Community

Maintainers

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

---

Top Contributors

[![raphaeltraviss](https://avatars.githubusercontent.com/u/2137944?v=4)](https://github.com/raphaeltraviss "raphaeltraviss (35 commits)")

---

Tags

decimaldevicehexadecimalimeicellphonecellularesnmeid

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/skyleaf-cellular-identifier/health.svg)

```
[![Health](https://phpackages.com/badges/skyleaf-cellular-identifier/health.svg)](https://phpackages.com/packages/skyleaf-cellular-identifier)
```

###  Alternatives

[brick/math

Arbitrary-precision arithmetic library

2.1k504.0M277](/packages/brick-math)[alexandernst/yii2-device-detect

Yii2 extension for Mobile-Detect library

141846.2k3](/packages/alexandernst-yii2-device-detect)[lab404/laravel-auth-checker

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

223164.9k2](/packages/lab404-laravel-auth-checker)[php-decimal/php-decimal

Correctly-rounded arbitrary precision decimal floating point

781.0M9](/packages/php-decimal-php-decimal)[ssnepenthe/color-utils

A PHP library for performing SASS-like color manipulations.

631.1M10](/packages/ssnepenthe-color-utils)[prestashop/decimal

Object-oriented wrapper/shim for BC Math PHP extension. Allows for arbitrary-precision math operations.

178.2M5](/packages/prestashop-decimal)

PHPackages © 2026

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