Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Markable

Laravel Markable Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Laravel Markable

Frequently asked questions about Laravel Markable
How do I install Laravel Markable and set up migrations for only the mark types I need?
Run `composer require maize-tech/laravel-markable` and then `php artisan markable:install` to publish the config. Use the `--tag` flag with `vendor:publish` to publish only the migrations you need, like `php artisan vendor:publish --tag="markable-migration-like"`. Finally, run `php artisan migrate` to apply them.
Which Laravel versions does Laravel Markable officially support?
Laravel Markable officially supports Laravel 11–13 as of version 3.0, with backward compatibility for older versions. The package leverages modern Laravel features like morphs and Eloquent scopes, ensuring smooth integration.
Can I customize the user model or table prefix for markable features?
Yes, the package provides a centralized config file (`config/markable.php`) where you can specify the fully qualified class name of your user model and adjust table prefixes. This avoids hardcoding and allows flexibility for different environments.
How do I add a custom mark type (e.g., 'Watchlist') beyond the default likes, bookmarks, and favorites?
Extend the package by creating a custom mark model that inherits from the abstract `Mark` class. Publish a migration for your new table, then configure it in the `markable.php` config. The package’s modular design makes this straightforward for custom use cases.
Does Laravel Markable support metadata for marks (e.g., timestamps, custom data)?
Yes, marks can include metadata stored in a JSON column. This allows you to attach additional data like timestamps, reasons, or custom attributes. However, you’ll need to enforce schema validation at the application level if strict constraints are required.
How do I query models that have a specific mark (e.g., 'liked' posts) efficiently?
Use Eloquent’s `whereHas` method with the provided scopes, like `Post::whereHasLike($userId)`. For performance, ensure you eager-load relations (e.g., `with(['likes.user'])`) to avoid N+1 query issues, especially in high-traffic applications.
Is Laravel Markable suitable for high-traffic applications with millions of marks per day?
The package is lightweight and scalable, but high write volumes may require optimization. Consider caching mark counts (e.g., with Redis) or implementing database indexing for frequently queried columns. The package itself doesn’t include built-in locking, so handle concurrency manually if needed.
How do I test markable functionality in CI without hitting the database?
Mock mark operations in unit tests by using Laravel’s testing helpers (e.g., `createMarkable()`) or by stubbing the `Mark` models. For integration tests, use transactions to roll back migrations after tests. The package includes tests, but custom marks may need additional test coverage.
What are the alternatives to Laravel Markable for adding likes/bookmarks to Eloquent models?
Alternatives include `spatie/laravel-activitylog` (for activity tracking), `laravel-activity` (for event-based marks), or custom implementations using Eloquent relationships. However, Laravel Markable stands out for its dedicated mark types, configurable migrations, and clean API for common social interactions.
How do I handle real-time updates (e.g., WebSocket notifications) for marks like likes or reactions?
Laravel Markable doesn’t include real-time features, but you can integrate it with Laravel Echo or similar tools. Trigger events (e.g., `MarkCreated`) when marks are added/removed, then broadcast these events to clients. Pair this with a queue for scalability if needed.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai