maize-tech/laravel-markable
Add likes, bookmarks, favorites, reactions and more to Laravel models with a simple “markable” system. Includes install command, configurable user model and table prefix, and optional publishable migrations per mark type for quick setup.
Like, Bookmark, Reaction) without requiring all features. This aligns well with Laravel’s Eloquent-based architecture and promotes separation of concerns.Maize\Markable\Mark, enabling domain-specific adaptations (e.g., Bookmark, Favorite). This is ideal for applications requiring flexible interaction patterns beyond standard likes/reactions.markable_likes, markable_reactions) to optimize query performance for mark-specific operations. This avoids bloated pivot tables and improves scalability for high-traffic markable entities.Markable) and migrations. Zero framework conflicts expected.markable:install).--tag="markable-migration-like").use Markable + $marks array).Like::add(), Reaction::toggle()), reducing cognitive load for developers.whereHasLike() enable database-level filtering, critical for performance in feeds or search results.bookmark migrations if needed). Risk of orphaned tables if not managed carefully.
Mitigation: Document migration tags in README and provide a default migration script for all mark types.user_id/markable_id columns.
Mitigation: Add indexes in migrations and benchmark under load.BackedEnum requirement). Risk for legacy codebases.
Mitigation: Use feature flags or conditional logic to support older Laravel versions.Like, Bookmark, Reaction) are essential vs. optional for MVP?Reaction::heart) map to business logic (e.g., analytics, UI triggers)?topic in Like) be standardized or left flexible?Like::toggle(), integration tests for whereHasLike())BackedEnum). Ensure runtime compatibility with your stack.Watchlist, Report).composer require maize-tech/laravel-markable
php artisan markable:install
--tag="markable-migration-like").config/markable.php (e.g., user_model, table_prefix).use Markable trait to target models (e.g., Post, Course).$marks array:
protected static $marks = [
Like::class,
Bookmark::class,
];
markable_watchlists).Maize\Markable\Mark for custom logic (e.g., Watchlist model).POST /posts/{id}/like).axios.post('/like', { postId })).BackedEnum.table_prefix (default: markable_).Cache::tags('post:123')->put()) for performance.likes_count in searchable attributes).Like, Bookmark, and Reaction for MVP features.Watchlist) if needed.Like::add(..., ['reason' => 'useful'])).Post::likesCount).markable.log) for business intelligence.config/markable.php in feature flags or environment configs for multi-tenant apps.Like) may evolve; plan for custom mark isolation if forking.Mark::where('markable_id', $id)->exists().EXPLAIN ANALYZE on markable_likes).markableRelationName conflicts."How can I help you explore Laravel packages today?