PHPackages                             dlds/yii2-mlm - 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. dlds/yii2-mlm

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

dlds/yii2-mlm
=============

Yii2 Multi Level Marketing component

2.0.14(7y ago)183.8k14[2 issues](https://github.com/dlds/yii2-mlm/issues)BSDPHP

Since Apr 11Pushed 7y ago3 watchersCompare

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

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

Multi level marketing rewrds module
===================================

[](#multi-level-marketing-rewrds-module)

Module handles rewards generating from appropriate subjects.

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

[](#installation)

`composer require dlds/yii2-mlm`

What is MLM?
------------

[](#what-is-mlm)

MLM is referal marketing system where user get reward for succesfull produc sharing/solding. It is similar to Affiliate marketing but has more then one rewards level. In MLM you build your own structure (own team) of users.

Exmaple:

| –– YOU
| –––– BOB *(1st level rewards)*
| –––––––– ROBERT *(2st level rewards)*
| –––– ALICE *(1st level rewards)*
| –––––––– JIMMY *(2st level rewards)*
| –––––––– GEORGE *(2st level rewards)*
| ––––––––––––– MARK *(3st level rewards)*

In this scenario you will get some reward when any of 6 users in your structure buy a product.

Entities in Module
------------------

[](#entities-in-module)

Folowing naming and entities are used in MLM module.

`Subject`

Class which is used as source for reward generation. It is usually some sort of **ProductOrder** or other entity which works with user payments.

`Participant`

Class which represents user identity among MLM structure.

`Reward`

Class which represents single rewards entry.

Implementation of module
------------------------

[](#implementation-of-module)

First of you have to prepare your database. There is MySQL Workbench schema / SQL import script showing simple example of DB structure required for implementation in [app/data](./app/data/schema.sql) folder.

There are following tables:

1. subject
2. participant
3. rwd\_basic
4. rwd\_extra
5. rwd\_custom

> As you can see there are 3 types of rewards. There is no need to use all 3 types. Standart rewards are held in table rwd\_basic. More about rewards types in secrion Reward Types.

Then you have to implement following interfaces into your application.

`MlmSubjectInterface`

This interfaces is usually implemented by something like **ProductOrder.php**

`MlmParticipantInterface`

This interfaces is usually implemented by something like **UsrIdentityModel.php**

`MlmRewardInterface`

This interfaces is usually implemented by something like **OrderReward.php**

How module works?
-----------------

[](#how-module-works)

After required implementation the rewards generation and verification is processed automatically by cron and console commands.

When `Subject` is ready to generate rewards module will automatically generate appropiate amount of rewards based on module setup.

During creation each participant is verified if is eligible to take rewards.

After then each of this rewards is verified when reach the end of protection period of time (e.g. 14 days in which the subject order can be cancelled by user)

After that reward is approved and is ready to pay off. Paying off handling is not part of this module yet.

Module Setup
------------

[](#module-setup)

Module provides bunch of setup options which can change the rewards generation.

`rules` array

Defines procentual amount of subject price will be used for each level of reward.

Example showing 40% of subject price is pushed into rewards and spread among 5 levels:

```
[
    1 => 20,
    2 => 10,
    3 => 5,
    4 => 3,
    5 => 2
]
```

`limitRules` int

Restriction for rules configuration. Defines maximal procentual sum of all rules. In example above 40 will be suitable.

`delayPending` int (unix format)

Indicates how long will every single reward be in protection state. During this time the reward will have PENDING state. After this delay the APPROVED/DENY state will be used.

For 1 day the value 86400 must be used. It is unix value for one day: 14 \* 24 \* 60 \* 60 = 86400

`roundPrecision` int

Number of decimal places for reward value.

`roundMode` enum (Mlm::MLM\_ROUND\_UP | Mlm::MLM\_ROUND\_DOWM)

Indicates if reward value will be rounded up or down.

`skipWorthlessRewards` boolean

When true the zero reward or rewards which value is 0.0000... after rounding will be ignored.

`clsParticipant` string

Participant model class name in your application.

`clsRewardBasic` string

Basic Rewards model class name in your application.

`clsSubjects` array

Class names of all subjects in your application. You can have 1 to N subjects defined in this array and all will get rewards.

`isCreatingActive` boolean

Enables / disables reward creation.

`isVerifyingActive` boolean

Enables / disables reward verification. Verification is processed after protection period.

`isLevelRestrictionAllowed`

When true the rewards will be created with special verification on participant. As default the participant is verified only if is eligible to take rewards. But when Level Restriction is Allowed the participant will be verified if is eligible to take reward of specific level in structure.

This means that you can restrict some participant to be able to take only 1st and 2nd level of rewards and another participant to be able to take all levels of rewards.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 61.7% 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 ~31 days

Recently: every ~0 days

Total

38

Last Release

2876d ago

Major Versions

0.3 → 1.0.02015-05-13

1.1.4 → 2.0.02017-06-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/23f0d05bb48111bd348c97af007c453b374ba03c36ec4fd114dfd73896bf5958?d=identicon)[dlds](/maintainers/dlds)

---

Top Contributors

[![jirisvoboda](https://avatars.githubusercontent.com/u/10264326?v=4)](https://github.com/jirisvoboda "jirisvoboda (29 commits)")[![svobik7](https://avatars.githubusercontent.com/u/761766?v=4)](https://github.com/svobik7 "svobik7 (18 commits)")

---

Tags

yii2componentmlm

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/dlds-yii2-mlm/health.svg)

```
[![Health](https://phpackages.com/badges/dlds-yii2-mlm/health.svg)](https://phpackages.com/packages/dlds-yii2-mlm)
```

###  Alternatives

[umanskyi31/opengraph

Created a new component for Yii2. The Open Graph component for your website

119.7k](/packages/umanskyi31-opengraph)

PHPackages © 2026

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