PHPackages                             mamadali/yii2-favorites - 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. mamadali/yii2-favorites

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

mamadali/yii2-favorites
=======================

user favorites extension for yii2 application

v1.1(4y ago)0191Apache-2.0PHP

Since Feb 15Pushed 4y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (1)Versions (5)Used By (0)

Installation
============

[](#installation)

[![Latest Stable Version](https://camo.githubusercontent.com/bc360b852d9d6374078755d844c8b81ef9a8aad2af6e45871aba456cf143deda/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d616d6164616c692f796969322d6661766f72697465732e737667)](https://packagist.org/packages/mamadali/yii2-favorites)[![Total Downloads](https://camo.githubusercontent.com/8a5d5b65994c7e26cfc9a5dc6fbf125b1fe078da0cd8fcfbb026043e384a84f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d616d6164616c692f796969322d6661766f72697465732e737667)](https://packagist.org/packages/mamadali/yii2-favorites)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require --prefer-dist mamadali/yii2-favorites "*"

```

or add

```
"mamadali/yii2-favorites": "*"

```

to the require section of your `composer.json` file.

then run migrations

```
php yii migrate/up --migrationPath=@vendor/mamadali/yii2-favorites/migrations

```

first add to config.php or if use advanced project add to common/config/main.php

```
    'components' => [
        ...
        'favorites' => [
            'class' => 'mamadali\favorites\Favorite',
        ],
        ...
    ];
```

Usage
=====

[](#usage)

How to add product to user favorites

```
   Yii::$app->favorites->add(Product::class, $product->id);
```

Note: this method return true when user not loged in

How to remove product from user favorites

```
   Yii::$app->favorites->remove(Product::class, $product->id);
```

How to check if product is in user favorites

```
   Yii::$app->favorites->has(Product::class, $product->id);
```

How to get all user favorites from Product model

```
   Yii::$app->favorites->getAll(Product::class);
```

How to get count of user favorites from Product model

```
   Yii::$app->favorites->getCount(Product::class);
```

How to get data provider from favorite Products

```
   Yii::$app->favorites->getDataProvider(Product::class);
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

Total

4

Last Release

1546d ago

Major Versions

v0.2 → v1.02022-02-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b1a551511f14b87b786d64eb6869179ebb700c6faaf9c6bc7795346dfffee41?d=identicon)[MamadAli](/maintainers/MamadAli)

---

Top Contributors

[![MamadAliGit](https://avatars.githubusercontent.com/u/70506682?v=4)](https://github.com/MamadAliGit "MamadAliGit (7 commits)")

---

Tags

yii2extensionwishlistFavoritesyii2-user-favoritsyii2 favoritesyii2-wishlist

### Embed Badge

![Health badge](/badges/mamadali-yii2-favorites/health.svg)

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

###  Alternatives

[vyants/yii2-daemon

Extension provides functionality for simple daemons creation and control

7859.0k](/packages/vyants-yii2-daemon)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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