PHPackages                             shaygan/affiliate-bundle - 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. shaygan/affiliate-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

shaygan/affiliate-bundle
========================

A simple Symfony Affiliate Bundle.

5.0.2(2mo ago)62931MITPHPPHP ^8.1CI failing

Since Nov 15Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/Shaygan/AffiliateBundle)[ Packagist](https://packagist.org/packages/shaygan/affiliate-bundle)[ Docs](http://i-gh.ir)[ RSS](/packages/shaygan-affiliate-bundle/feed)WikiDiscussions master Synced 2w ago

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

ShayganAffiliateBundle
======================

[](#shayganaffiliatebundle)

A simple **Symfony Affiliate Bundle** compatible with **Symfony 6.4+ and 7.x**.

This FOSUserBundle compatible Bundle tracks referrals with query string parameter and detect referred registrations via cookie. You can easily ask the bundle for commission amount (if there is any referrer) and apply the amount to referrer's user account.

Your Order Object needs to implements \\Shaygan\\AffiliateBundle\\Model\\OrderInterface.

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Symfony 6.4 or 7.x
- Doctrine ORM 2.10+ or 3.x

Install
-------

[](#install)

Via Composer

```
$ composer require shaygan/affiliate-bundle
```

### Symfony 6.4+ / 7.x

[](#symfony-64--7x)

If you're using Symfony Flex, the bundle will be automatically registered. Otherwise, register it manually in `config/bundles.php`:

```
return [
    // ...
    Shaygan\AffiliateBundle\ShayganAffiliateBundle::class => ['all' => true],
];
```

### Older Symfony Versions

[](#older-symfony-versions)

For Symfony 4.4/5.x, please use an earlier version of this bundle.

Configure the bundle
--------------------

[](#configure-the-bundle)

This bundle was designed to just work out of the box. The only thing you have to configure in order to get this bundle up and running is your commission type amount and count.

```
# config/packages/shaygan_affiliate.yaml

shaygan_affiliate:
    programs:
        membership_upgrade:
            type: fixed-amount
            first_commission_amount: 3
            commission_amount: 1
            max_count: 10
        purchase:
            type: percentage
            first_commission_percent: 15
            commission_percent: 10
            max_count: 10
```

By default it look for ?ref=REFERRER\_ID in URLs the *ref* is configurable

Usage
-----

[](#usage)

ShayganAffiliateBundel tracks FOSUserBundle registrations automatically and after every purchase you just need to ask the bundle for the commission payment if the referrer eligible for commission the bundle with return a commission Entity that contain the amount you have to pay to the referrer, othervise returns null.

```
  // ...
  // MyOrder SHOULD implements \Shaygan\AffiliateBundle\Model\OrderInterface
  $order = new \AppBundle\Entity\MyOrder();
  $order->setOwnerUser($this->getUser());

  $em = $this->getDoctrine()->getManager();
  $em->persist($order);
  $em->flush();
  $affiliate = $this->get("shaygan_affiliate");
  $commission = $affiliate->getPurchaseCommission($order);
  if(null !== $commission){
    $commissionAmount = $commission->getCommissionAmount();
    $referrer = $commission->getReferrer();
    $referrerUserId = $referrer->getId();
    // You can apply the commission amount to the accont of referrer User here
    // ...
  }
  //...
```

Testing
-------

[](#testing)

Not implemented yet

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance87

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 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.

###  Release Activity

Cadence

Every ~98 days

Recently: every ~4 days

Total

33

Last Release

62d ago

Major Versions

0.2.1 → 1.0.02020-09-22

1.1.2 → 2.02022-01-05

2.0.1 → 3.02025-11-12

3.6.3 → 4.0.02026-06-01

4.0.1 → 5.0.02026-06-01

PHP version history (4 changes)0.1.1PHP ^5.5.9 || ^7.0

1.1.1PHP ^7.0

2.0PHP ^7.0|^8.0

3.0PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

phpsymfonybundlesymfony8symfony6symfony7affiliateaffiliate-bundle

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/shaygan-affiliate-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/shaygan-affiliate-bundle/health.svg)](https://phpackages.com/packages/shaygan-affiliate-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k18.3M430](/packages/easycorp-easyadmin-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

12017.1k](/packages/rcsofttech-audit-trail-bundle)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.9M535](/packages/pimcore-pimcore)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1617.3k16](/packages/2lenet-crudit-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M778](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M236](/packages/sulu-sulu)

PHPackages © 2026

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