PHPackages                             shiftechafrica/shift-code-generator - 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. shiftechafrica/shift-code-generator

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

shiftechafrica/shift-code-generator
===================================

This package generates code in relation to year, date and month. For instance, it uses A - Z letters for months.

v1.5.3(1y ago)12.5k1MITPHPCI passing

Since May 1Pushed 7mo agoCompare

[ Source](https://github.com/SHIFTECH-AFRICA/shift-code-generator)[ Packagist](https://packagist.org/packages/shiftechafrica/shift-code-generator)[ RSS](/packages/shiftechafrica-shift-code-generator/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (6)Dependencies (2)Versions (17)Used By (0)

[![Shiftech Africa Logo](https://camo.githubusercontent.com/40288c9bb16963e1bf5f43ad228c15507849fd9603645dc021cb7d4b517b542b/68747470733a2f2f73686966746563686166726963612e636f6d2f696d672f6c6f676f2e706e67)](https://shiftechafrica.com/)

[](#)

 **Be in the next level**
 [ ![](https://camo.githubusercontent.com/83be1f479b2adb955ded31b59ca05213247e6a28235ef766a9826f340c4147fe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f53484946544543482d4146524943412f73686966742d636f64652d67656e657261746f722e737667) ](https://github.com/SHIFTECH-AFRICA/shift-code-generator/issues) [ ![](https://camo.githubusercontent.com/09f86302ca5da4a2658b04c7fa1968a8c7e80f785ca5cda124d2b5eefbf1f399/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f53484946544543482d4146524943412f73686966742d636f64652d67656e657261746f722e737667) ](https://github.com/SHIFTECH-AFRICA/shift-code-generator/network/members) [ ![](https://camo.githubusercontent.com/cbc09c548c5d2a438dd7f66ccabf1891a4ec970c7fe373d253a4a31bfa55f778/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f53484946544543482d4146524943412f73686966742d636f64652d67656e657261746f722e737667) ](https://github.com/SHIFTECH-AFRICA/shift-code-generator/stargazers) [ ![](https://camo.githubusercontent.com/d154e09e4aa09f8e2877f20afeface49f4a8cb310ae582d78a7297d61ae75fdf/68747470733a2f2f706f7365722e707567782e6f72672f73686966746563686166726963612f73686966742d636f64652d67656e657261746f722f762f737461626c65) ](https://packagist.org/packages/shiftechafrica/shift-code-generator) [ ![](https://camo.githubusercontent.com/7e7286ea069b35aa9c5e3aca57b2cd923452d2fe72a5b15b91049621b089ac9b/68747470733a2f2f706f7365722e707567782e6f72672f73686966746563686166726963612f73686966742d636f64652d67656e657261746f722f646f776e6c6f616473) ](https://packagist.org/packages/shiftechafrica/shift-code-generator)

 [![Shift Code Generator Animation](https://camo.githubusercontent.com/49ec1edc0091bb35971104aa171b3c423cb811e83c3387c5843f0a86529de37e/68747470733a2f2f692e70696e696d672e636f6d2f6f726967696e616c732f63652f36392f34662f63653639346635363036333664666663663432656366343064346632663936322e676966)](https://camo.githubusercontent.com/49ec1edc0091bb35971104aa171b3c423cb811e83c3387c5843f0a86529de37e/68747470733a2f2f692e70696e696d672e636f6d2f6f726967696e616c732f63652f36392f34662f63653639346635363036333664666663663432656366343064346632663936322e676966)

---

🚀 Introduction
--------------

[](#-introduction)

**Shift Code Generator** is a lightweight Laravel/PHP package that generates unique alphanumeric codes based on the **year**, **month**, and **day**, followed by a randomized string.
It’s ideal for applications that require sequential or time-based identifiers — such as **transaction IDs**, **invoice numbers**, or **reference codes**.

For example:
`1E1NKJDQVW`

- **1** → Represents the number of years since the start year
- **E** → Represents the month (A–Z mapping)
- **1** → Represents the day of the month
- **NKJDQVW** → Randomly generated string

This logic mimics the behavior of **M-Pesa transaction IDs**, ensuring unique, traceable, and time-bound identifiers.

---

⚙️ Installation
---------------

[](#️-installation)

Install via [Composer](https://getcomposer.org/):

```
composer require shiftechafrica/shift-code-generator
```

Update to the latest version:

```
composer update shiftechafrica/shift-code-generator --lock
```

If the package isn’t automatically discovered, run:

```
composer dump-autoload
```

Publish the configuration file:

```
php artisan vendor:publish --provider="ShiftechAfrica\CodeGenerator\ShiftCodeGeneratorServiceProvider"
```

This will create a config file at:

```
config/shift-code-generator.php

```

---

⚙️ Configuration
----------------

[](#️-configuration)

In your `.env` file, add the following:

```
YEAR_OF_START=2020     # The year your application was launched
USE_DATABASE=false     # Set to true to use database tracking, or false to use static year configuration
```

If you enable database tracking, seed the database by adding this entry to your `DatabaseSeeder`:

```
/**
 * Seed the application's database.
 *
 * @return void
 */
public function run()
{
     // Other seeds...
     $this->call(\ShiftechAfrica\CodeGenerator\Seeds\ShiftCodeGeneratorFactory::class);
}
```

This ensures your application initializes with proper baseline data for generating codes dynamically.

---

🧩 Usage
-------

[](#-usage)

Generate unique codes easily within your application.

```
use ShiftechAfrica\CodeGenerator\ShiftCodeGenerator;

/**
 * Generate a new Shift Code
 *
 * @return string
 */
public function generateCode()
{
    return (new ShiftCodeGenerator())->generate();
    // Optionally pass an integer to set the random length, e.g. ->generate(5)
}
```

### Example Output

[](#example-output)

```
1E1NKJDQVW

```

- **1** = Year offset
- **E** = Month letter
- **1** = Day
- **NKJDQVW** = Random string

---

🧭 Version Guidance
------------------

[](#-version-guidance)

VersionStatusPackagistNamespaceRelease**1.x**✅ Latest`shiftechafrica/shift-code-generator``ShiftechAfrica\CodeGenerator`[v1.5.2](https://github.com/SHIFTECH-AFRICA/shift-code-generator/releases/tag/v1.5.2)---

🛡️ Security Vulnerabilities
---------------------------

[](#️-security-vulnerabilities)

If you discover a security vulnerability, please contact:
📧 **[Bugs](mailto:bugs@shiftech.co.ke)**

---

📄 License
---------

[](#-license)

This package is open-source software licensed under the
**[MIT License](https://opensource.org/licenses/MIT)**

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance56

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 81.1% 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 ~128 days

Recently: every ~261 days

Total

15

Last Release

412d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a666611c24d993ba2d2326c1d0e7dbf772a0b1d89c6da6bdecd5537b58644f2?d=identicon)[shiftechafrica](/maintainers/shiftechafrica)

---

Top Contributors

[![general-oisebe](https://avatars.githubusercontent.com/u/154009443?v=4)](https://github.com/general-oisebe "general-oisebe (30 commits)")[![dev-techguy](https://avatars.githubusercontent.com/u/36882600?v=4)](https://github.com/dev-techguy "dev-techguy (5 commits)")[![shiftechafrica](https://avatars.githubusercontent.com/u/60717528?v=4)](https://github.com/shiftechafrica "shiftechafrica (2 commits)")

---

Tags

code-generatormpesampesa-apimpesatransactionnumbersafaricomlaravelcode generatormpesampesa-like-codetransactionId

### Embed Badge

![Health badge](/badges/shiftechafrica-shift-code-generator/health.svg)

```
[![Health](https://phpackages.com/badges/shiftechafrica-shift-code-generator/health.svg)](https://phpackages.com/packages/shiftechafrica-shift-code-generator)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[foryoufeng/laravel-generator

A tool for generate Laravel code file

712.8k](/packages/foryoufeng-laravel-generator)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

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