Download the PHP package quellabs/recommender without Composer
On this page you can find all versions of the php package quellabs/recommender. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download quellabs/recommender
More information about quellabs/recommender
Files in quellabs/recommender
Package recommender
Short Description Collaborative filtering recommendation engine (item-based CF and Slope One) using CakePHP 5 database layer
License MIT
Informations about the package recommender
quellabs/recommender
Collaborative filtering recommendation engine for PHP 8.2+, built on the CakePHP 5 database layer. Implements two complementary algorithms:
- Item-based collaborative filtering — "people who liked A also liked B"
- Slope One — lightweight weighted rating prediction for unrated items
Based on the Vogoo PHP recommendation engine (2007–2008) by Stéphane Droux, modernised for PHP 8.2+ and the Quellabs ecosystem.
Requirements
- PHP 8.2+
cakephp/database^5.0- MySQL (the incremental link update queries use MySQL-specific
UPDATE ... JOINandINSERT ... ON DUPLICATE KEY UPDATEsyntax)
Installation
Setup
1. Publish the configuration file
This copies config/recommender.php to your project root. Edit it to tune the engine constants. Database credentials
are read from config/database.php, which is shared with other Canvas packages.
2. Create the database tables
Creates vogoo_ratings and vogoo_links. Use --force to drop and recreate existing tables.
3. Populate the link table
If you have existing ratings, rebuild the link table from scratch:
To rebuild a single category only:
Database schema
vogoo_ratings
Stores member/product ratings.
| Column | Type | Description |
|---|---|---|
member_id |
INT UNSIGNED | Your application's user ID |
product_id |
INT UNSIGNED | Your application's product/item ID |
category |
INT UNSIGNED | Category grouping (default: 1) |
rating |
FLOAT | 0.0–1.0, or -1.0 for "not interested" |
ts |
DATETIME | Last updated timestamp |
vogoo_links
Stores pre-computed item co-occurrence counts and Slope One diff values. Populated by the rebuild command or maintained incrementally.
| Column | Type | Description |
|---|---|---|
item_id1 |
INT UNSIGNED | First item in the pair |
item_id2 |
INT UNSIGNED | Second item in the pair |
category |
INT UNSIGNED | Category grouping |
cnt |
INT | Co-occurrence count |
diff_slope |
FLOAT | Accumulated Slope One rating differential |
Configuration
All options with their defaults:
direct_links and direct_slope are independent. You can enable either or both:
direct_links |
direct_slope |
|
|---|---|---|
| Powers | getLinkedItems(), memberGetRecommendedItems() |
getSlopeItems(), memberPredict(), memberPredictAll() |
| Counts | Co-occurrence (liked pairs only) | All rated pairs |
When both are false, vogoo_links is read-only at runtime and must be rebuilt manually.
Usage
With Canvas (autowired)
RecommendationEngine and ItemRecommender are resolved automatically by the Canvas DI container — their
constructors depend only on Connection (provided by quellabs/canvas-database) and RecommendationConfig
(provided by this package), so no manual wiring is required:
Standalone
API reference
RecommendationEngine
Handles rating CRUD. All write methods trigger incremental link/slope updates when direct_links or direct_slope is
enabled.
ItemRecommender
Item-based CF and Slope One recommendations.
All methods accept an optional $filter (array of allowed product IDs), $limit, and $category parameter.
UserSimilarity
User-based CF. Similarity scores range from 0 (no overlap) to 100 (identical taste).
Note:
getNeighbours()computes similarity against every candidate neighbour in PHP. For large member sets, pre-compute and cache neighbour lists.
VisitorContext
Holds in-memory ratings for anonymous visitors. Persist and restore it across requests via session serialization.
Statistics
Sculpt CLI commands
| Command | Description |
|---|---|
sculpt recommender:init |
Publish config/recommender.php |
sculpt recommender:init-db |
Create vogoo_ratings and vogoo_links tables |
sculpt recommender:init-db --force |
Drop and recreate tables |
sculpt recommender:rebuild-links |
Rebuild vogoo_links from all ratings |
sculpt recommender:rebuild-links --category=N |
Rebuild a single category |
Multi-category support
Every method accepts an optional ?int $category parameter. When omitted it falls back to the category value in
RecommendationConfig (default: 1). To work with multiple catalogues, either pass the category explicitly or
instantiate separate RecommendationConfig objects per category:
License
MIT