Skip to main content

Laravel Like Package

A powerful and flexible Laravel package that adds social interaction features to your Eloquent models with minimal setup.

Laravel Like Package

✨ 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

  1. Install the package via Composer:
composer require cslant/laravel-like
  1. Publish the configuration file and migrations:
php artisan vendor:publish --provider="CSlant\LaravelLike\Providers\LikeServiceProvider"
  1. 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 IDs
  • table_name: Customize the interactions table name
  • interaction_model: Specify a custom interaction model
  • users.model: Configure the user model
  • users.foreign_key: Set the user foreign key

📚 Documentation

Explore the comprehensive documentation to get the most out of Laravel Like:

🤝 Contributing

Contributions are welcome! Please see our contributing guide for details.

📄 License

This package is open-sourced software licensed under the MIT License.

📊 Stats

LicenseLatest VersionTotal DownloadsTest StatusCode Style StatusQuality Score