Download the PHP package bnacci/gamio without Composer
On this page you can find all versions of the php package bnacci/gamio. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package gamio
Short Description Gamio: a lightweight Laravel package for user XP, leveling and gamification.
License MIT
Informations about the package gamio
Gamio Level System and Xp
I spent a lot of time trying to find a simple package that would provide me with an effective level and xp system and according to what I was looking for, I tried using some (they are good, but not for me) so I decided to create my own and from that desire Gamio was born.
Features
- Level and XP
- Badges
- Leaderboard
- User rank
Installation
IInstall the package via Composer:
Publish the config file:
Publish the migration files:
Publish the view files:
Then just add Leveable Trait (Bnacci\Gamio\Traits\Leveable) to User Model:
Migrations
Migrations
Gamio adds new columns to your users table (xp, level, coins, eligible). Run the migrations:
Configuration
The config file is located at config/gamio.php. Here you can customize:
Usage
You can now use the new methods on your User model.
Add xp to user:
Make the user eligible to receive experience points:
Get user progress:
User progress return a json object like:
Reset user progress:
Get user rank:
Get the leaderboard for all users using leaderboard() method or @leaderboard directive or accessing the /leaderboard route (publish the views to update the leaderboard view)
Get user badges:
Note: The level will be generated automatically based on the amount of XP, so there is no method to add levels.
Badges
To create badges Gamio has an artisan command to make this easier for you, just run:
The badge will be created in:
All badges will have the suffix "Badge" and when creating a new badge Gamio will create the file Badges/UserBadges.php:
The badge file will contain the following code:
How to use badges:
You won't need to do anything to use them because as soon as you create them, it generates UserBadges.php containing all your badges, and from there, Gamio takes over the role of awarding the badge according to the user's level. Just create it and you're good to go 😉.
Contributing
Thank you for considering contributing to Gamio! Fork the repo, create a branch, make your changes, and submit a PR.
License
This package is open-sourced software licensed under the MIT license.
All versions of gamio with dependencies
illuminate/database Version *
illuminate/filesystem Version *
illuminate/support Version *