Skip to content
No description or website provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig editorconfig Aug 3, 2017
.gitattributes gitattributes Aug 3, 2017
.gitignore first Nov 4, 2016
.travis.yml update deps Jan 29, 2018
LICENSE MPL 2.0 Jun 9, 2019 MPL 2.0 Jun 9, 2019
composer.json Laravel 6 Aug 28, 2019
phpunit.xml.dist first Nov 4, 2016
renovate.json Configure Renovate (#20) Oct 6, 2019

Laravel Leadboard

Build Status PHP from Packagist Latest Version License

This package offers to reward entities with points and to create a ranking based on these points.

It is possible to reward, penalize, multiply, redeem and reset points and entities can be blacklisted/whitelisted which makes it possible to prevent certain entities to receive points.

Each entity will receive a rank based on its points which could be used to display a listing of the users with the most points or something like that.


Require this package, with Composer, in the root directory of your project.

$ composer require artisanry/leaderboard

At last you need to publish the migration and run the migration:

php artisan vendor:publish --provider="Artisanry\Leaderboard\LeaderboardServiceProvider" && php artisan migrate




namespace App;

use Artisanry\Leaderboard\Traits\Boardable;

class User
    use Boardable;


$user = App\User::find(1);

$events = [
    'CompletedProfile'      => 10,
    'SocialLoginFacebook'   => 5,
    'SocialLoginTwitter'    => 5,
    'SocialLoginGoogleplus' => 5,

// User filled out address, phone, email, etc.
if($user->completedProfile()) {

// User added his Facebook profile
if($user->hasSocialProfile('facebook')) {

// User removed his Facebook profile
if($user->removedSocialProfile('facebook')) {

// User purchased a premium package
$plan = App\Plan::findByTitle('Premium');

if($user->purchased($plan)) {

// User wants to purchase something
$product = App\Product::find(1);

try {
    if($user->redeem($product->price)) {
        event(new ProductWasPurchased($product, $user));
} catch(\Artisanry\Leaderboard\Exceptions\InsufficientFundsException $e) {
    // Not enough points


Reward the given amount of points.


Remove the given amount of points.


Multiply all points by the given factor.


Redeem the given amount of points.


Reset all points to zero.


Blacklist the user. This will disable all functions except for blacklist/whitelist.


Whitelist the user.



$ phpunit


If you discover a security vulnerability within this package, please send an e-mail to All security vulnerabilities will be promptly addressed.


This project exists thanks to all the people who contribute.


Mozilla Public License Version 2.0 (MPL-2.0).

You can’t perform that action at this time.