Download the PHP package umutphp/laravel-model-recommendation without Composer

On this page you can find all versions of the php package umutphp/laravel-model-recommendation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-model-recommendation

Generate Recommendation List For Eloquent models

GitHub release (latest SemVer) WOSPM Checker Codestyle Check Test In All PHP Versions Markdown Linter

This package generates recommendation list for elequent models objects. It provides a simple API to work with to generate and list recommendations for a model.

Glosary

How To Install

Requiring The Library

Prepare The Database

Add The Service Provider

Append the following line to the providers array in config/app.php;

Add The Trait And Interface To The Model

Add HasRecommendation trait and InteractWithRecommendation interface to the class definition of the model. Please do not forget to implement the config function of the interface.

getRecommendationConfig(): It should returns a multi dimensional array as follows with correct values. The definition of values in inner arrays are;

A sample model class definition is as follows;

How To Use

Here are a few short examples of what you can do.

For these functions (generateRecommendations() and getRecommendations()) to be executed correctly, you should implement the config function described in Add The Trait And Interface To The Model section. The methods used to generate the recommendations and some use cases thay may help you are explained below.

Recommendation Generation Methods

DB Relation

This is an item based filtering (collaborative filtering) method by using the co-occurrence of the models in a data table under same group defined with a field.

Similarity

Inspired from the great articale "Building a Product Recommender System with Machine Learning in Laravel" by Oliver Lundquist.

The recommendation list is generated from a similarity calculation between models by using the field and taxonomy values of the objects.

Use Case 1

Assume that you want to get recommendations for products (sold together) in an e-commerce site. You have Product model and order_products table storing the relation between orders and products.

order_products table;

Field1 Field2 Field3 Field4 Field5 Field6
id order_id product_id product_count created_at updated_at

Product model class;

Function calls;

Use Case 2

Assume that you want to get recommendations for users in a dating site. You have User model and user_friends table storing the relation between users.

user_friends table;

Field1 Field2 Field3 Field4 Field5
id user_id friend_id created_at updated_at

Function calls;

Use Case 3

A use case for generating recommendations from product similarity. We have products and category table as follows and a one-to-one relation between them.

products table;

Field1 Field2 Field3 Field4 Field5
id color material price category_id

category table;

Field1 Field2
id name

Use Case 4

A hybrid use case (Use case 2 + Use case 3) containing both of the algorithms.

products table;

Field1 Field2 Field3 Field4 Field5
id color material price category_id

category table;

Field1 Field2
id name

order_products table;

Field1 Field2 Field3 Field4 Field5 Field6
id order_id product_id product_count created_at updated_at

Use Case 5

A use case for using with Laravel Follow package (User follow unfollow system for Laravel).

Laravel Follow package stores the data in user_follower table (Please check the migration). So, the implementation of the config function should be as follows;

Function calls;

Use Case 6

A use case for using with Laravel Acquaintances package (to manage friendships (with groups), followships along with Likes, favorites etc.).

Laravel Acquaintances package stores the data in interactions table (Please check the migration). So, the implementation of the config function should be as follows;

Function calls;

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-model-recommendation with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0|^8.1|^8.2|^8.3
illuminate/collections Version ^8.0|^9.0|^10.0|^11.0
illuminate/contracts Version ^8.0|^9.0|^10.0|^11.0
spatie/laravel-package-tools Version ^1.4.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package umutphp/laravel-model-recommendation contains the following files

Loading the files please wait ....