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. binafy/laravel-score

ActiveLibrary

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

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

v1.0.0(9mo ago)12701—0%MITPHPPHP ^8.0CI passing

Since Nov 26Pushed 8mo agoCompare

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

READMEChangelog (6)Dependencies (3)Versions (8)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

37

—

LowBetter than 83% of packages

Maintenance59

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

Recently: every ~1 days

Total

7

Last Release

292d 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 (78 commits)")

---

Tags

binafycomposerlaravellaravel-frameworklaravel-librarylaravel-packagelaravel-scorelaravel-score-pacakgelaravel-scoreablemilwadphpscorephplaravellaravel-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

[binafy/laravel-user-monitoring

Monitor your user and all activity on your application

57425.7k](/packages/binafy-laravel-user-monitoring)[binafy/laravel-cart

Laravel Cart is a customizable package for adding shopping cart functionality to Laravel applications

40445.9k](/packages/binafy-laravel-cart)[milwad/laravel-validate

The Laravel-Validate package enhanced Laravel validation capabilities with custom rules and methods for simplified and efficient validation logic.

59739.5k1](/packages/milwad-laravel-validate)[binafy/laravel-stub

Generate stub files easy

99158.8k10](/packages/binafy-laravel-stub)[imanghafoori/laravel-nullable

A package to help you write expressive defensive code in a functional manner

151423.7k6](/packages/imanghafoori-laravel-nullable)[binafy/laravel-reactions

React to something in Laravel framework

874.5k](/packages/binafy-laravel-reactions)

PHPackages © 2026

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