PHPackages                             antoineaugusti/laravel-easyrec - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. antoineaugusti/laravel-easyrec

ActiveLibrary[API Development](/categories/api)

antoineaugusti/laravel-easyrec
==============================

A Laravel wrapper for the recommendation system Easyrec

v1.0(11y ago)552.3k8[3 issues](https://github.com/AntoineAugusti/laravel-easyrec/issues)1Apache-2.0PHPPHP &gt;=5.4.0

Since Aug 23Pushed 11y ago5 watchersCompare

[ Source](https://github.com/AntoineAugusti/laravel-easyrec)[ Packagist](https://packagist.org/packages/antoineaugusti/laravel-easyrec)[ RSS](/packages/antoineaugusti-laravel-easyrec/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (15)Used By (1)

Laravel easyrec
===============

[](#laravel-easyrec)

[![Build Status](https://camo.githubusercontent.com/78f76984b90e2e17fdf90585389ef21fd828bfd2dd8e84b3bbb71252f67e83e6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f416e746f696e65417567757374692f6c61726176656c2d656173797265632f6d61737465722e7376673f7374796c653d666c6174)](https://travis-ci.org/AntoineAugusti/laravel-easyrec)[![Software License](https://camo.githubusercontent.com/b15dd5b7856b026d8183ded340ff646738284378f4736893fe785a746e482572/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d627269676874677265656e2e7376673f7374796c653d666c6174)](LICENSE.md)[![Latest Version](https://camo.githubusercontent.com/01f202d688da90338b7b46f8e7dd695a5398e5203374e50209303d2ab3d2d521/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f416e746f696e65417567757374692f6c61726176656c2d656173797265632e7376673f7374796c653d666c6174)](https://github.com/AntoineAugusti/laravel-easyrec/releases)

What is easyrec?
----------------

[](#what-is-easyrec)

easyrec is an open source recommendation engine system that provides personalized recommendations using a RESTful API.

The recommendation engine server
--------------------------------

[](#the-recommendation-engine-server)

You can use the server and call the associated RESTful API maintained by the easyrec team or download easyrec and call the API on one of your servers.

For additional information, take a look at the [easyrec website](http://easyrec.org).

#### Use easyrec with the server maintained by the team

[](#use-easyrec-with-the-server-maintained-by-the-team)

This is the ready-to-go solution. You may want to use this if you don't want to configure another server dedicated to easyrec.

- Create a easyrec account:
- Open up your mailbox and activate your account
- Create a new Tenant in your dashboard
- Fill your API key and your Tenant ID in the configuration file

#### Configure your own easyrec server

[](#configure-your-own-easyrec-server)

Take a look at the [easyrec installation guide](http://easyrec.sourceforge.net/wiki/index.php?title=Installation_Guide).

Installation
------------

[](#installation)

[PHP](https://php.net) 5.4+ or [HHVM](http://hhvm.com) 3.3+, and [Composer](https://getcomposer.org) are required.

To get the latest version of Laravel Easyrec, simply add the following line to the require block of your `composer.json` file:

```
"antoineaugusti/laravel-easyrec": "~1.0"

```

You'll then need to run `composer install` or `composer update` to download it and have the autoloader updated.

Once Laravel Easyrec is installed, you need to register the service provider. Open up `config/app.php` and add the following to the `providers` key.

- `'Antoineaugusti\LaravelEasyrec\LaravelEasyrecServiceProvider'`

You can register the Easyrec facade in the `aliases` key of your `config/app.php` file if you like.

- `'Easyrec' => 'Antoineaugusti\LaravelEasyrec\Facades\LaravelEasyrec'`

#### Looking for a Laravel 4 compatible version?

[](#looking-for-a-laravel-4-compatible-version)

Checkout the [0.5.4 version](https://github.com/AntoineAugusti/laravel-easyrec/releases/tag/v0.5.4), installable by requiring `"antoineaugusti/laravel-easyrec": "0.5.4"`. You can also checkout the `laravel-4` branch.

Configuration
-------------

[](#configuration)

To get started, you'll need to publish all vendor assets:

```
$ php artisan vendor:publish
```

This will create a `config/easyrec.php` file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

Usage
-----

[](#usage)

Actions
-------

[](#actions)

The following variables are common to the actions methods.

##### Required parameters

[](#required-parameters)

- `$itemid`: An item ID to identify an item on your website. Eg: "POST42"
- `$itemdescription`: An item description that is displayed when showing recommendations on your website.
- `$itemurl`: An item URL that links to the item page. Please give an absolute path.
- `$sessionid`: A session ID of a user. If not given, will try to guess with the Session facade `Session::getId()`

##### Optional parameters

[](#optional-parameters)

- `$userid`: A user ID.
- `$itemimageurl`: An optional item image URL that links to an imagine of the item. Please give an absolute path.
- `$actiontime`: An action time parameter that overwrites the current timestamp of the action. The parameter has the format "dd\_MM\_yyyy\_HH\_mm\_ss".
- `$itemtype`: An item type that denotes the type of the item (`IMAGE`, `BOOK` etc.). If not supplied, the default value `ITEM` will be used. **Warning**: before specifying a custom `itemtype` you must add this custom item type by using the web administration panel of Easyrec.

#### Errors

[](#errors)

If an error occurs, an exception `Antoineaugusti\LaravelEasyrec\Exceptions\EasyrecException` will be thrown with one of the following code and message:

- code 299: `Wrong APIKey/Tenant combination!`
- code 301: `Item requires an id!`
- code 303: `Item requires a description!`
- code 304: `Item requires a URL!`
- code 305: `Item requires a valid Rating Value!` (only when calling the `rate` method)
- code 401: `A session id is required!`
- code 912: `Operation failed! itemType XXX not found for tenant YYY`

### View

[](#view)

This action should be raised if a user views an item.

##### Function signature

[](#function-signature)

`Easyrec::view($itemid, $itemdescription, $itemurl, $userid = null, $itemimageurl = null, $actiontime = null, $itemtype = null, $sessionid = null)`

##### Parameters

[](#parameters)

Non-null variables in the function signature are required.

##### Example response

[](#example-response)

The response will be returned as a PHP array.

```
[
	"action": "view",
	"tenantid": "EASYREC_DEMO",
	"userid": "24EH1723322222A3",
	"sessionid": "F3D4E3BE31EE3FA069F5434DB7EC2E34",
	"item": [
	  "id": "42",
	  "itemType": "ITEM",
	  "description": "Fatboy Slim - The Rockafeller Skank",
	  "url": "/item/fatboyslim"
	]
]

```

### Buy

[](#buy)

This action should be raised if a user buys an item.

##### Function signature

[](#function-signature-1)

`Easyrec::buy($itemid, $itemdescription, $itemurl, $userid = null, $itemimageurl = null, $actiontime = null, $itemtype = null, $sessionid = null)`

##### Parameters

[](#parameters-1)

Non-null variables in the function signature are required.

##### Example response

[](#example-response-1)

The response will be returned as a PHP array.

```
[
	"tenantid": "EASYREC_DEMO",
	"action": "buy",
	"userid": "24EH1723322222A3",
	"sessionid": "F3D4E3BE31EE3FA069F5434DB7EC2E34",
	"item": [
	  "id": "42",
	  "type": "ITEM",
	  "description": "Fatboy Slim - The Rockafeller Skank",
	  "url": "/item/fatboyslim"
	]
]

```

### Rate

[](#rate)

This action should be raised if a user rates an item.

##### Function signature

[](#function-signature-2)

`Easyrec::rate($itemid, $ratingvalue, $itemdescription, $itemurl, $userid = null, $itemimageurl = null, $actiontime = null, $itemtype = null, $sessionid = null)`

##### Parameters

[](#parameters-2)

Non-null variables in the function signature are required. The rating value is an additional parameter.

- `$ratingvalue`: the rating value of the item. Must be an integer in the range from 1 to 10.

##### Example response

[](#example-response-2)

The response will be returned as a PHP array.

```
[
	"tenantid": "rate",
	"action": "rate",
	"userid": "24EH1723322222A3",
	"sessionid": "F3D4E3BE31EE3FA069F5434DB7EC2E34",
	"item": [
	  "id": "42",
	  "type": "ITEM",
	  "description": "Fatboy Slim - The Rockafeller Skank",
	  "ratingValue": "10",
	  "url": "/item/fatboyslim"
	]
]

```

### Send a custom action

[](#send-a-custom-action)

This action can be used to send generic user actions.

##### Function signature

[](#function-signature-3)

`sendAction($itemid, $itemdescription, $itemurl, $actiontype, $actionvalue = null, $userid = null, $itemimageurl = null, $actiontime = null, $itemtype = null, $sessionid = null)`

##### Parameters

[](#parameters-3)

Non-null variables in the function signature are required. There are two addition parameters.

- `$actiontype`: A required action type you want to use to send. **You must create the action type in the web interface before you can use it in API calls.**
- `$actionvalue`: If your action type uses action values this parameter is required. It is used to save the action value of your action.

##### Example response

[](#example-response-3)

The response will be returned as a PHP array.

```
[
	"tenantid": "rate",
	"action": "delete",
	"userid": "24EH1723322222A3",
	"sessionid": "F3D4E3BE31EE3FA069F5434DB7EC2E34",
	"item": [
	  "id": "42",
	  "type": "ITEM",
	  "description": "Fatboy Slim - The Rockafeller Skank",
	  "ratingValue": "10",
	  "url": "/item/fatboyslim"
	]
]

```

Recommendations
---------------

[](#recommendations)

The following variables are common to the recommendations methods.

##### Required parameters

[](#required-parameters-1)

- `$itemid`: An item ID to identify an item on your website. Eg: "POST42"

##### Optional parameters

[](#optional-parameters-1)

- `$userid`: A user ID. If this parameter is provided, items viewed by this user are suppressed.
- `$numberOfResults`: determine the number of results returned. Must be an integer in the range from 1 to 15.
- `$itemtype`: An item type that denotes the type of the item (`IMAGE`, `BOOK` etc.). If not supplied, the default value `ITEM` will be used. **Warning**: before specifying a custom `itemtype` you must add this custom item type by using the web administration panel of Easyrec.
- `$requesteditemtype`: A type of an item (e.g. `IMAGE`, `VIDEO`, `BOOK`, etc.) to filter the returned items. If not supplied the default value `ITEM` will be used.
- `$withProfile`: If this parameter is set to `true` the result contains an additional element `profileData` with the item profile. Default value to `false`.

#### Errors

[](#errors-1)

If an error occurs, an exception `Antoineaugusti\LaravelEasyrec\Exceptions\EasyrecException` will be thrown with one of the following code and message:

- code 299: `Wrong APIKey/Tenant combination!`
- code 300: `Item does not exist!`
- code 403: `No Userd Id given!` (only when calling the `recommendationsForUser` method)
- code 912: `Operation failed! itemType XXX not found for tenant YYY`

### Users also viewed

[](#users-also-viewed)

Users who viewed the specified item also viewed the returned items.

##### Function signature

[](#function-signature-4)

`Easyrec::usersAlsoViewed($itemid, $userid = null, $numberOfResults = 10, $itemtype = null, $requesteditemtype = null, $withProfile = false)`

##### Parameters

[](#parameters-4)

Non-null variables in the function signature are required.

##### Example response

[](#example-response-4)

The response will be returned as a PHP array.

```
[
	"tenantid": "EASYREC_DEMO",
	"action": "otherUsersAlsoViewed",
	"user": [
		"id": "24EH1723322222A3"
	],
	"baseitem": [
	  "item": [
		"id": "42",
		"type": "ITEM",
		"description": "Fatboy Slim - The Rockafeller Skank",
		"url": "/item/fatboyslim"
	  ]
	],
	"recommendeditems": [
	  "item": [
		"id": "43",
		"type": "ITEM",
		"description": "Beastie Boys - Intergalactic",
		"profileData": [
			"profile":[
				"year": "1990"
			]
		],
		"url": "/item/beastieboys"
	  ]
	],
	"listids": [
		43
	]
]

```

##### Retrieving your models

[](#retrieving-your-models)

Note that your models can be retrieved using this simple code:

```
YourModel::whereIn('id', $result['listids'])->get();
```

If you want to keep the order of the items, you can use this code if you are using **MySQL**:

```
$ids = $result['listids']:
YourModel::whereIn('id', $ids)
	->orderBy(DB::raw('FIELD(`id`, '.implode(',', $ids).')'))
	->get();
```

### Users also bought

[](#users-also-bought)

Users who bought the specified item also bought the returned items.

##### Function signature

[](#function-signature-5)

`Easyrec::usersAlsoBought($itemid, $userid = null, $numberOfResults = 10, $itemtype = null, $requesteditemtype = null, $withProfile = false)`

##### Parameters

[](#parameters-5)

Non-null variables in the function signature are required.

##### Example response

[](#example-response-5)

The response will be returned as a PHP array.

```
[
	"tenantid": "EASYREC_DEMO",
	"action": "otherUsersAlsoBought",
	"user": [
		"id": "24EH1723322222A3"
	],
	"baseitem": [
	  "item": [
		"id": "42",
		"type": "ITEM",
		"description": "Fatboy Slim - The Rockafeller Skank",
		"url": "/item/fatboyslim"
	  ]
	],
	"recommendeditems": [
	  "item": [
		"id": "43",
		"type": "ITEM",
		"description": "Beastie Boys - Intergalactic",
		"profileData": [
			"profile":[
				"year": "1990"
			]
		],
		"url": "/item/beastieboys"
	  ]
	],
	"listids": [
		43
	]
]

```

##### Retrieving your models

[](#retrieving-your-models-1)

Note that your models can be retrieved using this simple code:

```
YourModel::whereIn('id', $result['listids'])->get();
```

If you want to keep the order of the items, you can use this code if you are using **MySQL**:

```
$ids = $result['listids']:
YourModel::whereIn('id', $ids)
	->orderBy(DB::raw('FIELD(`id`, '.implode(',', $ids).')'))
	->get();
```

### Items rated good by other users

[](#items-rated-good-by-other-users)

Users who rated the specified item "good" did the same with items returned by this method.

##### Function signature

[](#function-signature-6)

`Easyrec::ratedGoodByOther($itemid, $userid = null, $numberOfResults = 10, $itemtype = null, $requesteditemtype = null, $withProfile = false)`

##### Parameters

[](#parameters-6)

Non-null variables in the function signature are required.

##### Example response

[](#example-response-6)

The response will be returned as a PHP array.

```
[
	"tenantid": "EASYREC_DEMO",
	"action": "itemsRatedGoodByOtherUsers",
	"user": [
		"id": "24EH1723322222A3"
	],
	"baseitem": [
	  "item": [
		"id": "42",
		"type": "ITEM",
		"description": "Fatboy Slim - The Rockafeller Skank",
		"url": "/item/fatboyslim"
	  ]
	],
	"recommendeditems": [
	  "item": [
		"id": "43",
		"type": "ITEM",
		"description": "Beastie Boys - Intergalactic",
		"profileData": [
			"profile":[
				"year": "1990"
			]
		],
		"url": "/item/beastieboys"
	  ]
	],
	"listids": [
		43
	]
]

```

##### Retrieving your models

[](#retrieving-your-models-2)

Note that your models can be retrieved using this simple code:

```
YourModel::whereIn('id', $result['listids'])->get();
```

If you want to keep the order of the items, you can use this code if you are using **MySQL**:

```
$ids = $result['listids']:
YourModel::whereIn('id', $ids)
	->orderBy(DB::raw('FIELD(`id`, '.implode(',', $ids).')'))
	->get();
```

### Recommendations for user

[](#recommendations-for-user)

Returns recommendations for a given user ID.

##### Function signature

[](#function-signature-7)

`Easyrec::recommendationsForUser($userid, $numberOfResults = 10, $requesteditemtype = null, $actiontype = "VIEW", $withProfile = false)`

##### Parameters

[](#parameters-7)

Non-null variables in the function signature are required. There is an additional parameter

- `$actiontype`: Allows to define which actions of a user are considered when creating the personalized recommendation. Valid values are: `VIEW`, `RATE`, `BUY`.

##### Example response

[](#example-response-7)

The response will be returned as a PHP array.

```
[
	"tenantid": "EASYREC_DEMO",
	"action": "recommendationsForUser",
	"user": [
		"id": "24EH1723322222A3"
	],
	"recommendeditems": [
	  "item": [
		"id": "43",
		"type": "ITEM",
		"description": "Beastie Boys - Intergalactic",
		"profileData": [
			"profile":[
				"year": "1990"
			]
		],
		"url": "/item/beastieboys"
	  ]
	],
	"listids": [
		43
	]
]

```

##### Retrieving your models

[](#retrieving-your-models-3)

Note that your models can be retrieved using this simple code:

```
YourModel::whereIn('id', $result['listids'])->get();
```

If you want to keep the order of the items, you can use this code if you are using **MySQL**:

```
$ids = $result['listids']:
YourModel::whereIn('id', $ids)
	->orderBy(DB::raw('FIELD(`id`, '.implode(',', $ids).')'))
	->get();
```

### History for user

[](#history-for-user)

Returns items which were involved in the latest user actions.

##### Function signature

[](#function-signature-8)

`Easyrec::actionHistoryForUser($userid, $numberOfResults = 10, $requesteditemtype = null, $actiontype = null)`

##### Parameters

[](#parameters-8)

Non-null variables in the function signature are required. There is an additional parameter

- `$actiontype`: Allows to define which actions of a user are considered when creating the personalized recommendation. Valid values are: `VIEW`, `RATE`, `BUY`.

##### Example response

[](#example-response-8)

The response will be returned as a PHP array.

```
[
	'action' => 'actionhistory',
	'recommendeditems' => [
		'item' => [
			0 => [
				'creationDate' => '2014-08-24 12:40:32.0',
				'description' => 'Quote 17982',
				'imageUrl' => [
					'@nil' => 'true'
				],
				'id' => '17982',
				'itemType' => 'QUOTE',
				'profileData' => [
					'@nil' => 'true'
				],
				'url' => 'http://example.com/quotes/17982'
			],
			1 => [
				'creationDate' => '2014-08-24 12:00:59.0',
				'description' => 'Quote 17987',
				'imageUrl' => [
					'@nil' => 'true'
				],
				'id' => '17987',
				'itemType' => 'QUOTE',
				'profileData' => [
					'@nil' => 'true'
				],
				'url' => 'http://example.com/quotes/17982'
			]
		]
	],
	'tenantid' => 'demo',
	'userid' => '27',
	'listids' => [
		0 => 17982,
		1 => 17987,
	]
]

```

##### Retrieving your models

[](#retrieving-your-models-4)

Note that your models can be retrieved using this simple code:

```
YourModel::whereIn('id', $result['listids'])->get();
```

If you want to keep the order of the items, you can use this code if you are using **MySQL**:

```
$ids = $result['listids']:
YourModel::whereIn('id', $ids)
	->orderBy(DB::raw('FIELD(`id`, '.implode(',', $ids).')'))
	->get();
```

Rankings
--------

[](#rankings)

The following variables are common to the rankings methods.

##### Optional parameters

[](#optional-parameters-2)

- `$numberOfResults`: determine the number of results returned. Must be an integer in the range from 1 to 50.
- `$requesteditemtype`: An item type that denotes the type of the item (`IMAGE`, `BOOK` etc.). If not supplied, the default value `ITEM` will be used.
- `$timeRange`: An optional parameter to determine the time range. Available values:
    - `DAY`: most viewed items within the last 24 hours
    - `WEEK`: most viewed items within the last week
    - `MONTH`: most viewed items within the last month
    - `ALL` (default): if no value or this value is given, the most viewed items of all time will be shown.
- `$withProfile`: If this parameter is set to `true` the result contains an additional element `profileData` with the item profile. Default value to `false`.

#### Errors

[](#errors-2)

If an error occurs, an exception `Antoineaugusti\LaravelEasyrec\Exceptions\EasyrecException` will be thrown with one of the following code and message:

- code 299: `Wrong APIKey/Tenant combination!`
- code 300: `Item does not exist!`
- code 912: `Operation failed! itemType XXX not found for tenant YYY`

### Most viewed items

[](#most-viewed-items)

Shows items that were viewed most by all users

##### Function signature

[](#function-signature-9)

`Easyrec::mostViewedItems($numberOfResults = 30, $timeRange = 'ALL', $requesteditemtype = null, $withProfile = false)`

##### Example response

[](#example-response-9)

The response will be returned as a PHP array.

```
[
	"tenantid": "EASYREC_DEMO",
	"action": "mostViewedItems",
	"recommendeditems": [
	  "item": [
		"id": "43",
		"type": "ITEM",
		"description": "Beastie Boys - Intergalactic",
		"profileData": [
			"profile": [
				"year": "1990"
			]
		],
		"url": "/item/beastieboys",
		"imageurl": "/img/covers/beastieboys.jpg",
		"value": "111.0"
	  ]
	],
	"listids": [
		43
	]
]

```

##### Retrieving your models

[](#retrieving-your-models-5)

Note that your models can be retrieved using this simple code:

```
YourModel::whereIn('id', $result['listids'])->get();
```

If you want to keep the order of the items, you can use this code if you are using **MySQL**:

```
$ids = $result['listids']:
YourModel::whereIn('id', $ids)
	->orderBy(DB::raw('FIELD(`id`, '.implode(',', $ids).')'))
	->get();
```

### Most bought items

[](#most-bought-items)

Shows items that were bought the most.

##### Function signature

[](#function-signature-10)

`Easyrec::mostBoughtItems($numberOfResults = 30, $timeRange = 'ALL', $requesteditemtype = null, $withProfile = false)`

##### Example response

[](#example-response-10)

The response will be returned as a PHP array.

```
[
	"tenantid": "EASYREC_DEMO",
	"action": "mostBoughtItems",
	"recommendeditems": [
	  "item": [
		"id": "43",
		"type": "ITEM",
		"description": "Beastie Boys - Intergalactic",
		"profileData": [
			"profile": [
				"year": "1990"
			]
		],
		"url": "/item/beastieboys",
		"imageurl": "/img/covers/beastieboys.jpg",
		"value": "111.0"
	  ]
	],
	"listids": [
		43
	]
]

```

##### Retrieving your models

[](#retrieving-your-models-6)

Note that your models can be retrieved using this simple code:

```
YourModel::whereIn('id', $result['listids'])->get();
```

If you want to keep the order of the items, you can use this code if you are using **MySQL**:

```
$ids = $result['listids']:
YourModel::whereIn('id', $ids)
	->orderBy(DB::raw('FIELD(`id`, '.implode(',', $ids).')'))
	->get();
```

### Most rated items

[](#most-rated-items)

Shows items that were rated the most.

##### Function signature

[](#function-signature-11)

`Easyrec::mostRatedItems($numberOfResults = 30, $timeRange = 'ALL', $requesteditemtype = null, $withProfile = false)`

##### Example response

[](#example-response-11)

The response will be returned as a PHP array.

```
[
	"tenantid": "EASYREC_DEMO",
	"action": "mostRatedItems",
	"recommendeditems": [
	  "item": [
		"id": "43",
		"type": "ITEM",
		"description": "Beastie Boys - Intergalactic",
		"profileData": [
			"profile": [
				"year": "1990"
			]
		],
		"url": "/item/beastieboys",
		"imageurl": "/img/covers/beastieboys.jpg",
		"value": "111.0"
	  ]
	],
	"listids": [
		43
	]
]

```

##### Retrieving your models

[](#retrieving-your-models-7)

Note that your models can be retrieved using this simple code:

```
YourModel::whereIn('id', $result['listids'])->get();
```

If you want to keep the order of the items, you can use this code if you are using **MySQL**:

```
$ids = $result['listids']:
YourModel::whereIn('id', $ids)
	->orderBy(DB::raw('FIELD(`id`, '.implode(',', $ids).')'))
	->get();
```

### Best rated items

[](#best-rated-items)

Shows the best rated items. The ranking only includes items that have **an average ranking value greater than 5.5.**

##### Function signature

[](#function-signature-12)

`Easyrec::bestRatedItems($numberOfResults = 30, $timeRange = 'ALL', $requesteditemtype = null, $withProfile = false)`

##### Example response

[](#example-response-12)

The response will be returned as a PHP array.

```
[
	"tenantid": "EASYREC_DEMO",
	"action": "bestRatedItems",
	"recommendeditems": [
	  "item": [
		"id": "43",
		"type": "ITEM",
		"description": "Beastie Boys - Intergalactic",
		"profileData": [
			"profile": [
				"year": "1990"
			]
		],
		"url": "/item/beastieboys",
		"imageurl": "/img/covers/beastieboys.jpg",
		"value": "111.0"
	  ]
	],
	"listids": [
		43
	]
]

```

##### Retrieving your models

[](#retrieving-your-models-8)

Note that your models can be retrieved using this simple code:

```
YourModel::whereIn('id', $result['listids'])->get();
```

If you want to keep the order of the items, you can use this code if you are using **MySQL**:

```
$ids = $result['listids']:
YourModel::whereIn('id', $ids)
	->orderBy(DB::raw('FIELD(`id`, '.implode(',', $ids).')'))
	->get();
```

### Worst rated items

[](#worst-rated-items)

Shows the worst rated items. The ranking only includes items that have **an average ranking value less than 5.5.**

##### Function signature

[](#function-signature-13)

`Easyrec::worstRatedItems($numberOfResults = 30, $timeRange = 'ALL', $requesteditemtype = null, $withProfile = false)`

##### Example response

[](#example-response-13)

The response will be returned as a PHP array.

```
[
	"tenantid": "EASYREC_DEMO",
	"action": "worstRatedItems",
	"recommendeditems": [
	  "item": [
		"id": "43",
		"type": "ITEM",
		"description": "Beastie Boys - Intergalactic",
		"profileData": [
			"profile": [
				"year": "1990"
			]
		],
		"url": "/item/beastieboys",
		"imageurl": "/img/covers/beastieboys.jpg",
		"value": "111.0"
	  ]
	],
	"listids": [
		43
	]
]

```

##### Retrieving your models

[](#retrieving-your-models-9)

Note that your models can be retrieved using this simple code:

```
YourModel::whereIn('id', $result['listids'])->get();
```

If you want to keep the order of the items, you can use this code if you are using **MySQL**:

```
$ids = $result['listids']:
YourModel::whereIn('id', $ids)
	->orderBy(DB::raw('FIELD(`id`, '.implode(',', $ids).')'))
	->get();
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~18 days

Recently: every ~54 days

Total

13

Last Release

4055d ago

Major Versions

v0.5.2 → v1.0-RC12015-02-07

v0.5.4 → v1.02015-04-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd9d5a56cb260e00c6d1963f9ba430b351227b65fe02ab535960d3b70ff35075?d=identicon)[AntoineAugusti](/maintainers/AntoineAugusti)

---

Top Contributors

[![AntoineAugusti](https://avatars.githubusercontent.com/u/295709?v=4)](https://github.com/AntoineAugusti "AntoineAugusti (63 commits)")

---

Tags

laravelrecommendationsuggestionssuggestionrecommendation systemeasyrec

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/antoineaugusti-laravel-easyrec/health.svg)

```
[![Health](https://phpackages.com/badges/antoineaugusti-laravel-easyrec/health.svg)](https://phpackages.com/packages/antoineaugusti-laravel-easyrec)
```

###  Alternatives

[irazasyed/telegram-bot-sdk

The Unofficial Telegram Bot API PHP SDK

3.3k4.5M84](/packages/irazasyed-telegram-bot-sdk)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[dcblogdev/laravel-xero

A Laravel Xero package

53129.1k1](/packages/dcblogdev-laravel-xero)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
