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

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

giftclub/laravel-referral
=========================

A Referral System With Laravel

0327PHP

Since Sep 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/johnsonsebire/Laravel-Referral)[ Packagist](https://packagist.org/packages/giftclub/laravel-referral)[ RSS](/packages/giftclub-laravel-referral/feed)WikiDiscussions master Synced 3d 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 questocat/laravel-referral "~1.0"
```

First add service providers into the config/app.php

```
\Questocat\Referral\ReferralServiceProvider::class,
```

Publish the migrations

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

Publish the config

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

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

[](#setup-the-model)

Add UserReferral Trait to your User model.

```
use Questocat\Referral\Traits\UserReferral

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

Usage
-----

[](#usage)

Assigning CheckReferral Middleware To Routes.

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

protected $routeMiddleware = [
    'referral' => \Questocat\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 = 'zhengchaopu';
$user->password = bcrypt('password');
$user->email = 'zhengchaopu@gmail.com';
$user->save();

// Or

$data = [
    'name' => 'zhengchaopu',
    'password' => bcrypt('password'),
    'email' => 'zhengchaopu@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

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[froiden/laravel-installer

Laravel web installer

10883.9k](/packages/froiden-laravel-installer)

PHPackages © 2026

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