PHPackages                             binafy/laravel-score - 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. [Database &amp; ORM](/categories/database)
4. /
5. binafy/laravel-score

ActiveLibrary[Database &amp; ORM](/categories/database)

binafy/laravel-score
====================

Laravel Score is a lightweight and flexible package for adding scoring functionality to any Eloquent model in a Laravel application

v1.1.0(2mo ago)13777↑12.5%MITPHPPHP ^8.0CI passing

Since Nov 26Pushed 2mo agoCompare

[ Source](https://github.com/binafy/laravel-score)[ Packagist](https://packagist.org/packages/binafy/laravel-score)[ RSS](/packages/binafy-laravel-score/feed)WikiDiscussions 1.x Synced 3w ago

READMEChangelog (7)Dependencies (6)Versions (10)Used By (0)

Laravel Score
=============

[](#laravel-score)

[![laravel-score](https://camo.githubusercontent.com/298d41503a17cb219c4dd081919ae9bc3c2603928740247257c968c707b9f890/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c25323053636f72652e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d62696e6166792532466c61726176656c2d73636f7265267061747465726e3d6f7665726c617070696e6748657861676f6e73267374796c653d7374796c655f32266465736372697074696f6e3d476976652b73636f72652b746f2b616c6c2b7468696e6773266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://camo.githubusercontent.com/298d41503a17cb219c4dd081919ae9bc3c2603928740247257c968c707b9f890/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c25323053636f72652e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d62696e6166792532466c61726176656c2d73636f7265267061747465726e3d6f7665726c617070696e6748657861676f6e73267374796c653d7374796c655f32266465736372697074696f6e3d476976652b73636f72652b746f2b616c6c2b7468696e6773266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)

[![PHP Version Require](https://camo.githubusercontent.com/cd5a2596f8548bfc088f16e4352a6caaf09a431cd9333cb21efb309788fe594f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f62696e6166792f6c61726176656c2d73636f72652f706870)](https://packagist.org/packages/binafy/laravel-score)[![Latest Stable Version](https://camo.githubusercontent.com/c64f37c53572d4f9edb71e2e0d3487d56d2d072bf716c35fd00ca78f4397ba90/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62696e6166792f6c61726176656c2d73636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/binafy/laravel-score)[![Total Downloads](https://camo.githubusercontent.com/baf6a22a8d0e0452e44018d6983c5e6a44f3eb7a913ad8ef33c05071380f9696/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62696e6166792f6c61726176656c2d73636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/binafy/laravel-score)[![License](https://camo.githubusercontent.com/cc1b256bd1574435436b583abc650f813e6410c9b1e8328c1c7abfbb93b2d8c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f62696e6166792f6c61726176656c2d73636f7265)](https://packagist.org/packages/binafy/laravel-score)[![Passed Tests](https://github.com/binafy/laravel-score/actions/workflows/tests.yml/badge.svg)](https://github.com/binafy/laravel-score/actions/workflows/tests.yml)[![Ask DeepWiki](https://camo.githubusercontent.com/0f5ae213ac378635adeb5d7f13cef055ad2f7d9a47b36de7b1c67dbe09f609ca/68747470733a2f2f6465657077696b692e636f6d2f62616467652e737667)](https://deepwiki.com/binafy/laravel-score)

Introduction
------------

[](#introduction)

A comprehensive Laravel package to implement scoring systems effortlessly. Whether you're building leaderboards, calculating performance metrics, or managing gamification features, Laravel Score provides an intuitive API to define, calculate, and manage scores seamlessly. Perfect for applications requiring dynamic and flexible scoring mechanisms.

Key Features:
-------------

[](#key-features)

- Simple integration with Eloquent models.
- Support for customizable scoring rules.
- Designed for performance and scalability.
- Extensible and developer-friendly.

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

[](#installation)

You can install the package with Composer.

```
composer require binafy/laravel-score
```

Publish
-------

[](#publish)

If you want to publish a config file you can use this command:

```
php artisan vendor:publish --tag="laravel-score-config"
```

If you want to publish the migrations you can use this command:

```
php artisan vendor:publish --tag="laravel-score-migrations"
```

For convenience, you can use this command to publish config, migration, and ... files:

```
php artisan vendor:publish --provider="Binafy\LaravelScore\Providers\LaravelScoreServiceProvider"
```

After publishing, run the `php artisan migrate` command.

Usage
-----

[](#usage)

To enable scoring functionality, you need to use two traits:

On the model giving the score (e.g. `User`):

```
use Binafy\LaravelScore\Traits\InteractWithScore;
use \Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use InteractWithScore;
}
```

On the model receiving the score (e.g. `Photo`):

```
use Binafy\LaravelScore\Traits\Scoreable;
use Illuminate\Database\Eloquent\Model;

class Photo extends Model
{
    use Scoreable;
}
```

### Add Score

[](#add-score)

To give a positive score to a scoreable model:

```
$user->addScore(
    Model $scoreable,
    int $score = 1,
    int|null $userId = null
);
```

### Add Negative Score

[](#add-negative-score)

To assign a negative score:

```
$user->addNegativeScore(
    Model $scoreable,
    int|null $userId = null
);
```

### Checking Scores

[](#checking-scores)

You can check whether a model has already been scored by a specific user:

```
$user->hasScored(
    Model $scoreable,
    int|null $userId = null
): bool;

$photo->isScored(
    ?int $userId = null
): bool;
```

### Count Scores

[](#count-scores)

To get the total number of scores for a model:

```
$photo->getScoresCount(): int;
```

### Delete score

[](#delete-score)

To remove an existing score:

```
$user->removeScore(Model $scoreable): bool;

$photo->removeScore(?int $userId = null): bool;
```

Contributors
------------

[](#contributors)

Thanks to all the people who contributed. [Contributors](https://github.com/binafy/laravel-score/graphs/contributors).

[![](https://camo.githubusercontent.com/121a86c0364084df8433a627b3034874f4ff93a5e2ecfe6ca3db81251ad5643d/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6c61726176656c2d73636f72652f636f6e7472696275746f72732e7376673f77696474683d38393026627574746f6e3d66616c7365)](https://github.com/binafy/laravel-score/graphs/contributors)

Security
--------

[](#security)

If you discover any security-related issues, please email `binafy23@gmail.com` instead of using the issue tracker.

Changelog
---------

[](#changelog)

The changelog can be found in the `CHANGELOG.md` file of the GitHub repository. It lists the changes, bug fixes, and improvements made to each version of the Laravel User Monitoring package.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/binafy/laravel-score/blob/1.x/LICENSE) for more information.

Star History
------------

[](#star-history)

[![Star History Chart](https://camo.githubusercontent.com/2b94f2ff8dea37398d45ec92591c3873186a1fd9d93f343eb8f56a4ce3af9918/68747470733a2f2f6170692e737461722d686973746f72792e636f6d2f7376673f7265706f733d62696e6166792f6c61726176656c2d73636f726526747970653d44617465)](https://star-history.com/#binafy/laravel-score&Date)

Donate
------

[](#donate)

If this package is helpful for you, you can buy a coffee for me :) ❤️

- Iranian Gateway: [https://daramet.com/milwad\_khosravi](https://daramet.com/milwad_khosravi)
- PayPal Gateway: SOON
- MetaMask Address: `0xf208a562c5a93DEf8450b656c3dbc1d0a53BDE58`

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance87

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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 ~64 days

Total

9

Last Release

64d ago

Major Versions

v0.9.5 → v1.0.02025-07-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/56315159ed0aaddaed135c51aa64d56800b7be05ead525b35a0057d18b44b40e?d=identicon)[binafy](/maintainers/binafy)

---

Top Contributors

[![milwad-dev](https://avatars.githubusercontent.com/u/98118400?v=4)](https://github.com/milwad-dev "milwad-dev (82 commits)")

---

Tags

binafycomposerlaravellaravel-frameworklaravel-librarylaravel-packagelaravel-scorelaravel-score-pacakgelaravel-scoreablemilwadphpscorephplaraveleloquentlaravel-packagemilwadbinafylaravel-librarylaravel-scorelaravel-scoreable

### Embed Badge

![Health badge](/badges/binafy-laravel-score/health.svg)

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11222.5M32](/packages/anourvalar-eloquent-serialize)[binafy/laravel-reactions

React to something in Laravel framework

875.6k](/packages/binafy-laravel-reactions)[ymigval/laravel-model-cache

Laravel package for caching Eloquent model queries

7955.4k4](/packages/ymigval-laravel-model-cache)[salehhashemi/laravel-repository

Implementing the repository pattern for Laravel projects.

2010.5k](/packages/salehhashemi-laravel-repository)[wayofdev/laravel-cycle-orm-adapter

🔥 A Laravel adapter for CycleORM, providing seamless integration of the Cycle DataMapper ORM for advanced database handling and object mapping in PHP applications.

3729.5k3](/packages/wayofdev-laravel-cycle-orm-adapter)[ntanduy/cloudflare-d1-database

Cloudflare D1 database driver for Laravel — full Eloquent &amp; Query Builder support.

276.8k](/packages/ntanduy-cloudflare-d1-database)

PHPackages © 2026

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