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.

3.4(6mo ago)62731MITPHPPHP ^8.1

Since Nov 15Pushed 6mo 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 1mo ago

READMEChangelog (10)Dependencies (9)Versions (25)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

48

—

FairBetter than 95% of packages

Maintenance68

Regular maintenance activity

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity82

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 ~127 days

Recently: every ~1 days

Total

24

Last Release

184d 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

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 (70 commits)")

---

Tags

phpsymfonybundlesymfony6affiliateaffiliate-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

[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[pentatrion/vite-bundle

Vite integration for your Symfony app

2755.3M13](/packages/pentatrion-vite-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[open-dxp/opendxp

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

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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