Download the PHP package janyksteenbeek/laravel-gorse without Composer
On this page you can find all versions of the php package janyksteenbeek/laravel-gorse. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download janyksteenbeek/laravel-gorse
More information about janyksteenbeek/laravel-gorse
Files in janyksteenbeek/laravel-gorse
Package laravel-gorse
Short Description Laravel integration for Gorse recommendation engine
License MIT
Homepage https://github.com/janyksteenbeek/laravel-gorse
Informations about the package laravel-gorse
Laravel Gorse
A Laravel integration for the Gorse recommendation engine. This package provides a seamless way to integrate Gorse's recommendation capabilities into your Laravel application.
Features
- Easy integration with Laravel's Eloquent models
- Automatic synchronization of users and items with Gorse
- Support for feedback tracking
- Simple recommendation retrieval
- Command-line tools for bulk synchronization
Requirements
- PHP 8.1 or higher
- Laravel 11.x or 12.x
- A running Gorse instance
Installation
You can install the package via composer:
After installation, publish the configuration file:
Configuration
Add the following environment variables to your .env file:
SSL Verification
By default, SSL certificate verification is enabled for security. However, in development environments or when using self-signed certificates, you may need to disable it. You can do this by setting GORSE_VERIFY_SSL=false in your .env file.
Note: It's recommended to keep SSL verification enabled in production environments.
Usage
Making Models Recommendable
To make a model recommendable (e.g., products, articles), use the HasGorseFeedback trait:
Making Users Receive Recommendations
To enable users to receive recommendations, use the HasGorseRecommendations trait:
Getting Recommendations
Auto-Sync
The package supports automatic synchronization of your models with Gorse. When enabled, any changes to your models (create, update, delete) will be automatically synchronized with Gorse. You can enable this feature by setting GORSE_AUTO_SYNC=true in your .env file.
Model Resolving
By default, when retrieving recommendations, the package will automatically resolve the recommended items into their respective Eloquent models. This means you'll get a collection of actual model instances instead of just IDs. You can disable this feature by setting GORSE_RESOLVING_ENABLED=false in your .env file.
Manual Synchronization
The package provides commands to manually sync your data with Gorse:
The --chunk option allows you to specify how many records should be processed at once (default: 100).
Using the Facade
You can also use the Gorse facade directly:
All recommendation methods return Laravel Collections, regardless of whether model resolution is enabled. This means you can use all of Laravel's Collection methods on both resolved and raw results:
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-gorse with dependencies
illuminate/contracts Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
illuminate/database Version ^11.0|^12.0
illuminate/console Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0