PHPackages                             bu4ak/promocode - 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. bu4ak/promocode

ActiveLibrary

bu4ak/promocode
===============

1.0.0(8y ago)044[1 issues](https://github.com/Bu4ak/promocode/issues)MITPHP

Since Mar 3Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Bu4ak/promocode)[ Packagist](https://packagist.org/packages/bu4ak/promocode)[ RSS](/packages/bu4ak-promocode/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

#### A small model that generates a discount code

[](#a-small-model-that-generates-a-discount-code)

##### Installation:

[](#installation)

- `composer require bu4ak/promocode`
- `php artisan migrate`

##### Usage example:

[](#usage-example)

- Generate:

```
$promo = \Bu4ak\Promocode\Models\Promocode::generate(10, 5);

route('promo', ['hash' => $promo->hash]);
// invitation link:
// http://localhost/promo/356ce01e0258f76ad83a7734b28142f144264689e8983b38f0f5948bae6dda51
```

- Url handling:

```
Route::get('/promo/{hash}', function ($hash) {
    $promo = \Bu4ak\Promocode\Models\Promocode::whereHash($hash)->firstOrFail();
        //or return view
    return ['your code' => $promo->code, 'discount' => $promo->discount];
})->name('promo');
```

###### Also, you can immediately give the user a code instead of a link. For example, in email. And use a discount when creating an order or a paid service

[](#also-you-can-immediately-give-the-user-a-code-instead-of-a-link-for-example-in-email-and-use-a-discount-when-creating-an-order-or-a-paid-service)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

2990d ago

### Community

---

Top Contributors

[![bu4ak](https://avatars.githubusercontent.com/u/17143820?v=4)](https://github.com/bu4ak "bu4ak (15 commits)")

### Embed Badge

![Health badge](/badges/bu4ak-promocode/health.svg)

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

PHPackages © 2026

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