Laravel Like Package
A powerful and flexible Laravel package that adds social interaction features to your Eloquent models with minimal setup.
![]()
✨ Features
- Multiple Interaction Types: Support for likes, dislikes, and loves out of the box
- Fully Extensible: Easily add custom interaction types
- Efficient Queries: Optimized database queries for high performance
- Polymorphic Relationships: Works with any Eloquent model
- Flexible Configuration: Customize table names, model references, and more
- Comprehensive API: Simple, intuitive methods for all interaction types
- Query Scopes: Powerful filtering and sorting capabilities
- UUID Support: Optional UUID support for primary keys
- Caching: Built-in caching for better performance
- Event-Driven: Fires events for all interactions
🚀 Getting Started
Requirements
- PHP 8.1 or higher
- Laravel 9.0 or higher
- Composer
Installation
- Install the package via Composer:
composer require cslant/laravel-like
- Publish the configuration file and migrations:
php artisan vendor:publish --provider="CSlant\LaravelLike\Providers\LikeServiceProvider"
- Run the migrations:
php artisan migrate
🔧 Configuration
The package comes with sensible defaults, but you can customize its behavior by modifying the config/like.php file. Key configuration options include:
is_uuids: Use UUIDs instead of auto-incrementing IDstable_name: Customize the interactions table nameinteraction_model: Specify a custom interaction modelusers.model: Configure the user modelusers.foreign_key: Set the user foreign key
📚 Documentation
Explore the comprehensive documentation to get the most out of Laravel Like:
- Basic Usage - Learn how to add interactions to your models
- Checking Interactions - Determine if users have interacted with content
- Counting Interactions - Get interaction counts and statistics
- Query Scopes - Filter and sort content by interaction data
- Customizing User Interaction - Custom interaction types and advanced features
🤝 Contributing
Contributions are welcome! Please see our contributing guide for details.
📄 License
This package is open-sourced software licensed under the MIT License.