PHPackages                             mwazovzky/favoritable - 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. mwazovzky/favoritable

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

mwazovzky/favoritable
=====================

Laravel Package allows app User to Favorite/Unfavorite Eloquent Model instance

v0.0.5(8y ago)138MITPHP

Since May 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mwazovzky/favoritable)[ Packagist](https://packagist.org/packages/mwazovzky/favoritable)[ RSS](/packages/mwazovzky-favoritable/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (5)Used By (0)

[![Build Status](https://camo.githubusercontent.com/cd9e6b711479c9f3d81c1bada4f3d99ed7a6bbf56b28c17e4d8f4d79482b5e51/68747470733a2f2f7472617669732d63692e6f72672f6d77617a6f767a6b792f6661766f72697461626c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mwazovzky/favoritable)[![Coverage Status](https://camo.githubusercontent.com/f8bda077ba0ad1f0605d89bda699801d2de65a7f938620f3477e2984e2bb09e5/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d77617a6f767a6b792f6661766f72697461626c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/mwazovzky/favoritable?branch=master)

 [![](https://camo.githubusercontent.com/640c3d52b2764f179ef3cf089b604516a8c4ac0a06f055a46c6a7fce9428b787/68747470733a2f2f6c61726176656c2e636f6d2f6173736574732f696d672f636f6d706f6e656e74732f6c6f676f2d6c61726176656c2e737667)](https://camo.githubusercontent.com/640c3d52b2764f179ef3cf089b604516a8c4ac0a06f055a46c6a7fce9428b787/68747470733a2f2f6c61726176656c2e636f6d2f6173736574732f696d672f636f6d706f6e656e74732f6c6f676f2d6c61726176656c2e737667)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#)

### Project: mwazovzky\\favoritable

[](#project-mwazovzkyfavoritable)

### Description

[](#description)

Laravel Package. Allows app User to favorite/unfavorite Eloquent Model instance.

#### Version: 0.0.6

[](#version-006)

#### Change log:

[](#change-log)

0.0.6 frontend assets added: `` vue component
0.0.5 frontend assets added: `` vue component and `favorite` vidget (blade partial)
0.0.4 routes and controller to favorite/unfavorite model added
0.0.3 package auto discovery (as of Laravel 5.5)
0.0.2 added Model::favoritedBy() methods that define Many-To-Many Polymorphic Relationships
0.0.1 initial project scaffolding

#### Installation.

[](#installation)

1. Pull the package into Laravel project

```
composer require mwazovzky/favoritable

```

2. For Laravel 5.4 or below register package service provider at `/config/app.php`.
    Package will be auto-registered for Laravel 5.5 and above.

```
// file config/app.php

...
'providers' => [
...
\MWazovzky\Favoritable\FavoritableServiceProvider::class
...
];
...

```

3. Run database migration to create `favorites` table

```
$ php artisan migrate

```

4. Use trait Favoritable for every Model that can be favorited by a User.
    Check trait docblocks for a list of available methods.

```
use \MWazovzky\Favoritable\Favoritable;

```

5. Package makes `favorite`/`unfavorite` endpoints available for the application via adding corresponding routes to 'web' routes group

```
Route::post('/favorites/{model}/{id}', 'FavoritesController@store')->name('favorites.store');
Route::delete('/favorites/{model}/{id}', 'FavoritesController@destroy')->name('favorites.destroy');

```

where `model` and `id` are short model class name (`kebab-case` for `KebabCase`) and id for the model being favorited/unfavorited.

6. Run artisan command to publish package assets to `/resources/assets/js/components/favoritable/Favorite.vue` folder:

```
$ php artisan vendor:publish --tag=assets

```

7. Published vue component are: `` - favorite/unfavorite button `` toggles `favorite` query string attribute.
8. Register components:

```
// file /resources/assets/js/app.js

Vue.component('favorite', require('./components/favoritable/Favorite.vue'));
Vue.component('favorite-vidget', require('./components/favoritable/FavoriteVidget.vue'));

```

Component usage

```
favoriteAttributes() }}>

```

where
`modelClass` is a short model class name (use `kebab-case` for `KebabCase`), `$model` is a model instance,
`Model::favoriteAttributes()` is a method provided by `Favoritable` trait.
Any object (e.g. model itself) that has: `id`, `isFavoreted` and `favoritesCount`fields may be passed as component `model` property.

```

```

Favorite vidget requires no parameters.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

4

Last Release

3106d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a718b7aa89a072f6ec5353ae15bc01594b378b46788f1e7e46503673d48de0f?d=identicon)[mwazovzky](/maintainers/mwazovzky)

---

Top Contributors

[![mwazovzky](https://avatars.githubusercontent.com/u/19958949?v=4)](https://github.com/mwazovzky "mwazovzky (44 commits)")

---

Tags

laravel

### Embed Badge

![Health badge](/badges/mwazovzky-favoritable/health.svg)

```
[![Health](https://phpackages.com/badges/mwazovzky-favoritable/health.svg)](https://phpackages.com/packages/mwazovzky-favoritable)
```

###  Alternatives

[imdhemy/laravel-purchases

The top-notch Laravel receipt validator.

3831.1M2](/packages/imdhemy-laravel-purchases)[martbock/laravel-diceware

Diceware Passphrase Generator for Laravel

3264.7k](/packages/martbock-laravel-diceware)[orchestra/auth

Auth Component for Orchestra Platform

24108.5k3](/packages/orchestra-auth)[ingria/laravel-x509-auth

Laravel 5 Client Certificate auth middleware

375.6k](/packages/ingria-laravel-x509-auth)

PHPackages © 2026

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