PHPackages                             chiwex/laravel-referral - 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. chiwex/laravel-referral

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

chiwex/laravel-referral
=======================

A Referral System With Laravel

01PHP

Since Jul 15Pushed 2y agoCompare

[ Source](https://github.com/techbly/laravel-referral)[ Packagist](https://packagist.org/packages/chiwex/laravel-referral)[ RSS](/packages/chiwex-laravel-referral/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

laravel-referral
================

[](#laravel-referral)

A Referral System With Laravel

[![StyleCI](https://camo.githubusercontent.com/1f25e23eb5b0522bc7be8eebf05bb2bb1ed8a4f3675363c944161865d70e58ad/68747470733a2f2f7374796c6563692e696f2f7265706f732f3131353931373831372f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/115917817)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/2f319a4e96fc9bc730d3410dfb26ef969318b04ac6709d4673d1c501738cf367/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f71756573746f6361742f6c61726176656c2d726566657272616c2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/questocat/laravel-referral/?branch=master)[![Build Status](https://camo.githubusercontent.com/21480bd4a1719addf7c68464d8c4f27a5c84d98d65e258a69eeb76db52c92dfe/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f71756573746f6361742f6c61726176656c2d726566657272616c2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/questocat/laravel-referral/build-status/master)[![Packagist](https://camo.githubusercontent.com/a4b7a1d8377c4252b62962b12857454a352b488c7f58770dcbcadcffaf57247b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f646f637472696e652f6f726d2e737667)](https://packagist.org/packages/questocat/laravel-referral)

Installation
------------

[](#installation)

Via [Composer](https://getcomposer.org) to add the package to your project's dependencies:

```
$ composer require chiwex/laravel-referral
```

First add service providers into the config/app.php

```
\Chiwex\Referral\ReferralServiceProvider::class,
```

Publish the migrations

```
$ php artisan vendor:publish --provider="Chiwex\Referral\ReferralServiceProvider" --tag="migrations"
```

Publish the config

```
$ php artisan vendor:publish --provider="Chiwex\Referral\ReferralServiceProvider" --tag="config"
```

Setup the model
---------------

[](#setup-the-model)

Add UserReferral Trait to your User model.

```
use Chiwex\Referral\Traits\UserReferral

class User extends Model
{
    use UserReferral;
}
```

Usage
-----

[](#usage)

Assigning CheckReferral Middleware To Routes.

```
// Within App\Http\Kernel Class...

protected $routeMiddleware = [
    'referral' => \Chiwex\Referral\Http\Middleware\CheckReferral::class,
];
```

Once the middleware has been defined in the HTTP kernel, you may use the middleware method to assign middleware to a route:

```
Route::get('/', 'HomeController@index')->middleware('referral');
```

Now you can create the user:

```
$user = new App\User();
$user->name = 'chiwex';
$user->password = bcrypt('password');
$user->email = 'donchiwexco@gmail.com';
$user->save();

// Or

$data = [
    'name' => 'chiwex',
    'password' => bcrypt('password'),
    'email' => 'donchiwexco@gmail.com',
];

App\User::create($data);
```

Get the referral link:

```
$user = App\User::findOrFail(1);

{{ $user->getReferralLink() }}
```

License
-------

[](#license)

Licensed under the [MIT license](https://github.com/questocat/laravel-referral/blob/master/LICENSE).

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 76.7% 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/82de017fec50c9c2bc5ff30933457f99fbcb99fa66c25aad549f526158919ced?d=identicon)[chiwex](/maintainers/chiwex)

---

Top Contributors

[![voocx](https://avatars.githubusercontent.com/u/8717817?v=4)](https://github.com/voocx "voocx (23 commits)")[![techbly](https://avatars.githubusercontent.com/u/7074565?v=4)](https://github.com/techbly "techbly (5 commits)")[![Havenstd06](https://avatars.githubusercontent.com/u/33732634?v=4)](https://github.com/Havenstd06 "Havenstd06 (2 commits)")

### Embed Badge

![Health badge](/badges/chiwex-laravel-referral/health.svg)

```
[![Health](https://phpackages.com/badges/chiwex-laravel-referral/health.svg)](https://phpackages.com/packages/chiwex-laravel-referral)
```

###  Alternatives

[permafrost-dev/phpcsfixer-preset

shared php-cs-fixer rules &amp; finders preset

226.5k1](/packages/permafrost-dev-phpcsfixer-preset)

PHPackages © 2026

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