PHPackages                             keithbrink/affiliates-spark - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. keithbrink/affiliates-spark

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

keithbrink/affiliates-spark
===========================

An affiliates package for Laravel Spark that allows you to track referrals from affiliates and pay commission

1.2.4(5y ago)24200↓80%7MITPHP

Since Jan 14Pushed 5y ago4 watchersCompare

[ Source](https://github.com/keithbrink/affiliates-spark)[ Packagist](https://packagist.org/packages/keithbrink/affiliates-spark)[ RSS](/packages/keithbrink-affiliates-spark/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (5)Versions (48)Used By (0)

AffiliatesSpark
===============

[](#affiliatesspark)

An affiliates package for [Laravel Spark](https://spark.laravel.com/) that allows you to track referrals from affiliates and pay commission.

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

[](#installation)

Cashier 10+ / Laravel 6+ is supported in the 1.\* releases. To use older versions, use one of the 0.\* releases.

To get the latest version, simply require the project using [Composer](https://getcomposer.org):

```
$ composer require keithbrink/affiliates-spark

```

Configuration
-------------

[](#configuration)

1. In your User model, add the Affiliate trait:

```
use KeithBrink\AffiliatesSpark\Traits\Affiliate as AffiliateTrait;

class User extends SparkUser {
    use AffiliateTrait;
    ...
}
```

2. In your SparkServiceProvider, add the following functions to handle adding affiliate IDs to the database:

```
Spark::createUsersWith('KeithBrink\AffiliatesSpark\Interactions\SaveAffiliateOnRegistration@createUser');
Spark::createTeamsWith('KeithBrink\AffiliatesSpark\Interactions\SaveAffiliateOnRegistration@createTeam');
```

or, if you want to add extra data to your user registration, use the interaction directly:

```
use KeithBrink\AffiliatesSpark\Interactions\SaveAffiliateOnRegistration;
...
Spark::createUsersWith(function ($request) {
    $extra_data = [
        ...
    ];

    $interaction = new SaveAffiliateOnRegistration;
    return $interaction->createUser($request, $extra_data);
});
```

3. Add a link for affiliates in the menu dropdown. Edit `\resources\views\vendor\spark\nav\user.blade.php`, and under the Developer menu item (line 65), add the following code:

```
@if (Auth::user()->isAffiliate())
    @include('affiliates-spark::nav.affiliate-menu-item')
@endif
```

4. Add a link for managing affiliates in the Kiosk menu. Edit your `\resources\views\vendor\spark\kiosk.blade.php`, and under the Metrics Link item (line 30), add the following code:

```

@include('affiliates-spark::nav.affiliate-menu-item-kiosk')
```

and in the same file under Tab Cards, add the following code:

```

@include('affiliates-spark::nav.affiliate-tab-item-kiosk')
```

5. Publish the package javascript with the command: `php artisan vendor:publish --provider="KeithBrink\AffiliatesSpark\AffiliatesSparkServiceProvider" --tag=javascript`. Then, in your `/resources/js/app.js`, require the package javascript:

```
require('./affiliates-spark/bootstrap');
```

Remember to compile the assets with `npm run dev`.

6. Publish the package views with the command: `php artisan vendor:publish --provider="KeithBrink\AffiliatesSpark\AffiliatesSparkServiceProvider" --tag=views`. You should enter instructions for your affiliates in `/resources/views/vendor/affiliates-spark/affiliates/instructions.blade.php`.
7. Run the package migrations with the command: `php artisan migrate --package "keithbrink/affiliates-spark`.

### Optional Configuration

[](#optional-configuration)

1. If you would like your customers to see the discount they are receiving from an affiliate on the subcription page, in your `resources/views/vendor/spark/settings/subscription/subscription-notice.blade.php` file, after the `@else` statement (line 9), add:

```
@include('affiliates-spark::subscription.affiliate-discount')
```

Usage
-----

[](#usage)

1. On any page that you would like to credit affiliates for sending people to, add the script: ``. You can also add the script to a different subdomain of the same top-level domain by making the src URL absolute rather than relative.

License
-------

[](#license)

SegmentSpark is licensed under [The MIT License (MIT)](LICENSE).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 93.8% 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 ~13 days

Recently: every ~36 days

Total

45

Last Release

2101d ago

Major Versions

0.2.4 → 1.0.02020-01-03

0.2.6 → 1.2.02020-03-17

0.2.8 → 1.2.12020-03-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/787337724116dcbbddb7bb34a4bf3625e1ecbb2e0a7d80d045b5cdc52b2b37f1?d=identicon)[KeithBrink](/maintainers/KeithBrink)

---

Top Contributors

[![keithbrink](https://avatars.githubusercontent.com/u/15267205?v=4)](https://github.com/keithbrink "keithbrink (76 commits)")[![samtlewis](https://avatars.githubusercontent.com/u/1706265?v=4)](https://github.com/samtlewis "samtlewis (3 commits)")[![ricoxor](https://avatars.githubusercontent.com/u/3131462?v=4)](https://github.com/ricoxor "ricoxor (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/keithbrink-affiliates-spark/health.svg)

```
[![Health](https://phpackages.com/badges/keithbrink-affiliates-spark/health.svg)](https://phpackages.com/packages/keithbrink-affiliates-spark)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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