Laravel Markable logo

Laravel Markable

Add likes, bookmarks, and reactions to Laravel models

A Laravel package that enables markable features—likes, favorites, bookmarks, reactions—on any Eloquent model with minimal configuration and custom metadata support.

Overview

Overview

Laravel Markable is a flexible package designed for Laravel developers who need to add user engagement features like likes, bookmarks, favorites, and reactions to their Eloquent models. By adding a single trait and defining mark types, you can enable rich interaction tracking across any model in your application.

Capabilities

The package supports both simple marks (likes, bookmarks) and value-based marks (reactions with emoji or custom values). Each mark type uses its own database table for optimal query performance. You can attach custom metadata to marks, define allowed value subsets, or use wildcards for unrestricted values. The API provides intuitive methods—add(), remove(), toggle(), has(), and count()—for managing marks and querying engagement data.

Extensibility

Developers can create custom mark types by extending the abstract Mark class and publishing corresponding migrations. The package ships with pre-built marks (Like, Bookmark, Favorite, Reaction) and allows full control over table naming via a configurable prefix. Ideal for content platforms, e-commerce, social networks, and any application requiring user interaction tracking.

Highlights

Add likes, bookmarks, favorites, and reactions to any Eloquent model with a single trait
Custom mark types with dedicated tables for optimized query performance
Value-based marks with configurable allowed values or wildcard support
Attach custom metadata to any mark for rich contextual tracking

Pros

  • Simple API with intuitive methods (add, remove, toggle, has, count)
  • Separate tables per mark type improve query performance at scale
  • Extensible architecture supports unlimited custom mark types
  • Built-in support for metadata and value constraints

Considerations

  • Requires separate migration publication and execution for each mark type
  • Multiple tables increase database schema complexity for large mark inventories
  • No built-in UI components; developers must implement frontend interactions
  • Configuration via array keys (lowercase class names) may be error-prone

Managed products teams compare with

When teams consider Laravel Markable, these hosted platforms usually appear on the same shortlist.

Bookmarkify logo

Bookmarkify

Visual bookmark manager for creative inspiration.

booky logo

booky

Online bookmark manager and start page for private, customizable collections.

Diigo logo

Diigo

Social bookmarking with web and PDF annotation.

Looking for a hosted option? These are the services engineering teams benchmark against before choosing open source.

Fit guide

Great for

  • Content platforms needing likes, favorites, and bookmarks on articles or media
  • E-commerce sites tracking product wishlists and user preferences
  • Social networks requiring reaction systems with custom emoji or values
  • Applications needing granular user engagement analytics with metadata

Not ideal when

  • Projects requiring real-time leaderboards without additional caching layers
  • Applications needing complex approval workflows or moderation for marks
  • Teams seeking turnkey UI components for mark interactions
  • Systems with strict single-table polymorphic requirements

How teams use it

Course platform with likes and bookmarks

Students can like courses and bookmark lessons, while instructors view engagement metrics to identify popular content.

Blog with emoji reactions

Readers react to posts with custom emojis, and editors analyze reaction distributions to gauge sentiment and topic resonance.

E-commerce wishlist and favorites

Shoppers bookmark products and mark favorites, enabling personalized recommendations and abandoned-wishlist campaigns.

Community forum with upvotes

Members upvote helpful answers, and the system surfaces top-rated content while tracking contributor reputation.

Tech snapshot

PHP100%

Tags

favoriteslaravelmarkablelikesmarksbookmarksreactions

Frequently asked questions

Can I use multiple mark types on the same model?

Yes. Add multiple mark class namespaces to the $marks array in your model, and each mark type will function independently with its own table.

How do I create a custom mark type?

Create a migration with the 'markable_' prefix, then extend the abstract Mark class and implement markableRelationName(). Optionally define allowed values in the config.

Can I attach extra data when a user marks something?

Yes. Pass an array as the third argument to add() or toggle() to store custom metadata in the JSON metadata column.

What happens if I use an invalid value for a reaction?

If allowed_values is defined and the value is not in the list (or wildcard), the package will reject the mark. Check the config for your mark type.

Does the package support soft deletes for marks?

The default migrations do not include soft deletes. You can modify the published migrations to add softDeletes() if needed.

Project at a glance

Active
Stars
749
Watchers
749
Forks
30
LicenseMIT
Repo age3 years old
Last commit2 days ago
Primary languagePHP

Last synced 12 hours ago