Skip to content

dereuromark/cakephp-favorites

Repository files navigation

CakePHP Favorites Plugin

CI Coverage Status PHPStan Latest Stable Version Minimum PHP Version License Total Downloads

Favorites plugin for CakePHP applications.

This branch is for use with CakePHP 5.0+. For details see version map.

Motivation

The old Favorites plugins don't seem to be supported anymore:

This plugin aims to merge and revive them as modern CakePHP 5.x plugin. Hopefully we can have all the features back up and working soon.

Features

"Favorites" lets people express how they feel about some content. Make any model reactable in a minutes!

There are many implementations in modern applications:

  • Starred a.k.a GitHub stars (and remove star)
  • GitHub Reactions
  • Facebook Reactions
  • YouTube Likes
  • Slack Reactions
  • Reddit Votes
  • Medium Claps

This package so far mainly supports basic reactions per entity in 3 different types:

  • star (yes/no)
  • like (upvote/downvote/none)
  • favorite (custom enum list)

But it could be developed in mind that it should cover all the possible use cases and be viable in enterprise applications including multiple reactions per entity. Help is appreciated.

A "counter-cache" field can be put on the starred record itself, to more easily count the "stars" without having to calculate it at runtime.

For ratings (e.g. 1-5 star range) use https://github.com/dereuromark/cakephp-ratings instead.

Install, Setup, Usage

See the Docs for details.

Demo

See https://sandbox.dereuromark.de/sandbox/favorite-examples