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

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

signdeer/laravel-referral
=========================

Laravel package for a referral system

v1.0.9(10mo ago)0755MITPHPPHP ^7.2|^7.3|^7.4|^8.0|^8.1|^8.2

Since Jun 29Pushed 10mo agoCompare

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

READMEChangelogDependencies (3)Versions (11)Used By (0)

This fork is maintained by [Signdeer](https://signdeer.com), a secure, modern platform for e-signatures, approvals, and digital document workflows built for African teams and global standards.

Key Features
------------

[](#key-features)

✅ Generate unique referral codes for users
✅ Track referrals and associate them with users
✅ Retrieve referrers and their referred users
✅ Customizable referral code length, cookie tracking, and redirection
✅ Simple trait-based integration with your `User` model

- [Installation](#installation)
    - [Configuration](#configuration)
    - [Migration](#migration)
    - [Add Trait](#add-trait)
- [Usage](#usage)
    - [Generate Referral Accounts for Existing Users](#generate-referral-accounts-for-existing-users)
    - [Get the Referrer of a User](#get-the-referrer-of-a-user)
    - [Get Referrer by Referral Code](#get-referrer-by-referral-code)
    - [Check if a User has a Referral Account](#check-if-a-user-has-a-referral-account)
    - [Create a Referral Account for a User](#create-a-referral-account-for-a-user)
    - [Get All Referrals of a User](#get-all-referrals-of-a-user)
    - [Get the Referral Link of a User](#get-the-referral-link-of-a-user)
- [Changelog](#changelog)
- [Contribution](#contributing)
- [License](#license)

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

[](#installation)

You can install the package via Composer by running the following command:

```
composer require signdeer/laravel-referral
```

#### Configuration

[](#configuration)

The package provides a configuration file that allows you to customize its behavior. You should publish the migration and the config/referral.php config file with:

```
php artisan vendor:publish --provider="Jijunair\LaravelReferral\Providers\ReferralServiceProvider"
```

After publishing, you can find the configuration file at config/referral.php.

Configuration KeyDescription`cookie_name`The name of the cookie that tracks referrals.`cookie_expiry`How long the referral cookie will be valid. (Default: 1 year)`route_prefix`The prefix used for referral links.`ref_code_prefix`The prefix added to the unique referral code for each user.`redirect_route`The page where users will go after clicking on a referral link.`user_model`The model class for the user.`referral_length`The length of the referral code for each user. (Default: 8 characters)These configuration options help customize the behavior of the referral system in your Laravel application. Feel free to adjust these values according to your preferences and requirements!

#### Migration

[](#migration)

After the config and migration have been published and configured, you can create the tables for this package by running:

```
 php artisan migrate
```

#### Add Trait

[](#add-trait)

Add the necessary trait to your User model:

```
use Jijunair\LaravelReferral\Traits\Referrable;

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

Usage
-----

[](#usage)

#### Generate Referral Accounts for Existing Users

[](#generate-referral-accounts-for-existing-users)

To generate referral accounts for existing users, you can visit the following URL:

```
http://localhost:8000/generate-ref-accounts

```

This will generate referral codes for all existing users in your application.

#### Get the Referrer of a User

[](#get-the-referrer-of-a-user)

To get the referrer of a user, you can use the following code:

```
use Illuminate\Support\Facades\Auth;

$user = Auth::user();
$referrer = $user->referralAccount->referrer;
```

This retrieves the referrer associated with the user.

#### Get Referrer by Referral Code

[](#get-referrer-by-referral-code)

To get the referrer by referral code, you can use the following code:

```
use Jijunair\LaravelReferral\Models\Referral;
use Illuminate\Support\Facades\Cookie;

$referralCode = Cookie::get(config('referral.cookie_name'));
$referrer = Referral::userByReferralCode($referralCode);
```

This retrieves the referrer based on the referral code stored in the cookie.

#### Check if a User has a Referral Account

[](#check-if-a-user-has-a-referral-account)

To check if a user has a referral account, you can use the following code:

```
$user->hasReferralAccount();
```

This returns `true` if the user has a referral account, and `false` otherwise.

#### Create a Referral Account for a User

[](#create-a-referral-account-for-a-user)

To create a referral account for a user, you can use the following code:

```
$user->createReferralAccount($referrer->id);
```

This associates the user with the provided referrer by creating a referral account.

#### Get All Referrals of a User

[](#get-all-referrals-of-a-user)

To get all referrals under a user, you can use the following code:

```
$referrals = $user->referrals;
```

This retrieves all the referrals associated with the user.

#### Get the Referral Link of a User

[](#get-the-referral-link-of-a-user)

To get the referral link of a user, you can use the following code:

```
$referralLink = $user->getReferralLink();
```

This returns the referral link associated with the user.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Thank you for considering contributing to the Laravel Referral Package! If you have any suggestions, bug reports, or pull requests, please feel free to open an issue or submit a pull request on the GitHub repository.

License
-------

[](#license)

The Laravel Referral Package is open-source software licensed under the [MIT](LICENSE) license.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance54

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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 ~0 days

Total

10

Last Release

318d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/08ac11012b6b39a4a4c33676163235f9a8c007fbacc61e0a5d61a6134cc5a348?d=identicon)[Vincent95](/maintainers/Vincent95)

---

Top Contributors

[![jijunair](https://avatars.githubusercontent.com/u/10154580?v=4)](https://github.com/jijunair "jijunair (18 commits)")[![Vincent95](https://avatars.githubusercontent.com/u/14187746?v=4)](https://github.com/Vincent95 "Vincent95 (11 commits)")[![makowskid](https://avatars.githubusercontent.com/u/6271194?v=4)](https://github.com/makowskid "makowskid (1 commits)")

---

Tags

laravelpackagereferralreferral-systemaffiliatelaravel-referraljijunairuser-referral

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[jijunair/laravel-referral

Laravel package for a referral system

9223.8k](/packages/jijunair-laravel-referral)[efureev/laravel-trees

Multi-Tree structures for Laravel

14253.3k4](/packages/efureev-laravel-trees)[gallib/laravel-short-url

A Laravel package to shorten urls

16516.4k](/packages/gallib-laravel-short-url)[tehwave/laravel-achievements

Simple, elegant Achievements the Laravel way

7012.8k](/packages/tehwave-laravel-achievements)[pdazcom/laravel-referrals

A referrals system for a laravel projects.

301.5k](/packages/pdazcom-laravel-referrals)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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