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

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

questocat/laravel-referral
==========================

A Referral System With Laravel

v1.0.1(6y ago)13887.6k↓32.7%33[2 PRs](https://github.com/questocat/laravel-referral/pulls)MITPHPPHP &gt;=7.0

Since Apr 14Pushed 3y ago6 watchersCompare

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

READMEChangelog (1)Dependencies (3)Versions (5)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
```

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

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 92% 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 ~377 days

Total

3

Last Release

2202d ago

Major Versions

v1.0.0 → 2.0.x-dev2019-01-09

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

affiliate-trackingreferralreferral-systemreferralaffiliate-trackingreferral-system

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[jijunair/laravel-referral

Laravel package for a referral system

9223.8k](/packages/jijunair-laravel-referral)[fisharebest/webtrees

webtrees online genealogy

73710.5k13](/packages/fisharebest-webtrees)[mdwheele/swotphp

Identify email addresses or domains names that belong to colleges or universities.

6847.8k1](/packages/mdwheele-swotphp)[symbiote/silverstripe-dynamiclists

A Module that allows users to create custom data lists. These lists can then be used in a form control (specified via code by a developer) or within a user defined form to be able to define controlled vocabularies managed in a central location that might be used across several forms.

109.5k1](/packages/symbiote-silverstripe-dynamiclists)[pure_mashiro/magento2-bundlejs

Advanced JavaScript Bundling

111.5k](/packages/pure-mashiro-magento2-bundlejs)

PHPackages © 2026

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