{"id":33967280,"url":"https://github.com/bnacci/gamio","last_synced_at":"2026-04-01T23:01:50.535Z","repository":{"id":347221480,"uuid":"1066442058","full_name":"bnacci/gamio","owner":"bnacci","description":"Gamio Level System and XP is a Laravel package that adds an experience (XP) and leveling system directly to the user model. It brings RPG-inspired progression mechanics to your application, boosting engagement in social platforms, apps, and other systems","archived":false,"fork":false,"pushed_at":"2025-09-29T13:45:08.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-28T00:42:39.752Z","etag":null,"topics":["experince","gamification","laravel","level-system","levelup"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/bnacci/gamio","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bnacci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-29T13:43:53.000Z","updated_at":"2025-09-29T13:46:51.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bnacci/gamio","commit_stats":null,"previous_names":["bnacci/gamio"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bnacci/gamio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnacci%2Fgamio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnacci%2Fgamio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnacci%2Fgamio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnacci%2Fgamio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bnacci","download_url":"https://codeload.github.com/bnacci/gamio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnacci%2Fgamio/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["experince","gamification","laravel","level-system","levelup"],"created_at":"2025-12-12T23:41:06.765Z","updated_at":"2026-04-01T23:01:50.516Z","avatar_url":"https://github.com/bnacci.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gamio Level System and Xp\n\nI 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.\n\n## Features\n\n- Level and XP\n- Badges\n- Leaderboard\n- User rank\n\n## Installation\n\nIInstall the package via Composer:\n\n```sh\n  composer require bnacci/gamio\n```\n\nPublish the config file:\n\n```sh\n    php artisan vendor:publish --provider=\"Bnacci\\Gamio\\Providers\\GamioProvider\" --tag=\"gamio-config\"\n```\n\nPublish the migration files:\n\n```sh\n    php artisan vendor:publish --provider=\"Bnacci\\Gamio\\Providers\\GamioProvider\" --tag=\"gamio-migrations\"\n```\n\nPublish the view files:\n\n```sh\n    php artisan vendor:publish --provider=\"Bnacci\\Gamio\\Providers\\GamioProvider\" --tag=\"gamio-views\"\n```\n\nThen just add Leveable Trait (Bnacci\\Gamio\\Traits\\Leveable) to User Model:\n\n```php\n    \u003c?php\n\n    namespace App\\Models;\n\n    // use Illuminate\\Contracts\\Auth\\MustVerifyEmail;\n    use Illuminate\\Database\\Eloquent\\Factories\\HasFactory;\n    use Illuminate\\Foundation\\Auth\\User as Authenticatable;\n    use Illuminate\\Notifications\\Notifiable;\n\n    use Bnacci\\Gamio\\Traits\\Leveable; // Leveable Trait Here\n\n    class User extends Authenticatable\n    {\n        /** @use HasFactory\u003c\\Database\\Factories\\UserFactory\u003e */\n        use HasFactory, Notifiable;\n        use Leveable; // Add this line to your model\n\n        /**\n        * The attributes that are mass assignable.\n        *\n        * @var list\u003cstring\u003e\n        */\n        protected $fillable = [\n            'name',\n            'email',\n            'password',\n        ];\n\n        /**\n        * The attributes that should be hidden for serialization.\n        *\n        * @var list\u003cstring\u003e\n        */\n        protected $hidden = [\n            'password',\n            'remember_token',\n        ];\n\n        /**\n        * Get the attributes that should be cast.\n        *\n        * @return array\u003cstring, string\u003e\n        */\n        protected function casts(): array\n        {\n            return [\n                'email_verified_at' =\u003e 'datetime',\n                'password' =\u003e 'hashed',\n            ];\n        }\n    }\n```\n\n## Migrations\n\nMigrations\n\nGamio adds new columns to your users table (xp, level, coins, eligible).\nRun the migrations:\n\n```sh\nphp artisan migrate\n```\n\n## Configuration\n\nThe config file is located at config/gamio.php.\nHere you can customize:\n\n```php\n\u003c?php\n\nreturn [\n    /**\n     * The maximum level a user can achieve in the level system.\n     * This defines the highest level in the system, users cannot level up beyond this.\n     */\n    \"max_level\"         =\u003e 100,\n\n    /**\n     * The user model to be used by the level system.\n     * This specifies the fully qualified class name of the model that will be used\n     * to manage users within the system. By default, it's set to the User model in the app.\n     */\n    \"user_model\"        =\u003e \\App\\Models\\User::class,\n\n    /**\n     * The limit on how many users should be displayed in the leaderboard.\n     * This determines how many top users are shown in the leaderboard at a time.\n     * The default value is set to 10.\n     */\n    \"leaderboard_limit\" =\u003e 10,\n];\n```\n\n## Usage\n\nYou can now use the new methods on your User model.\n\nAdd xp to user:\n\n```php\n    \u003c?php\n\n    $user = User::find(1);\n    $user-\u003eaddXp(50);\n\n    echo $user-\u003exp;     // 50\n    echo $user-\u003elevel;  // 1 (The initial level is 1 and the maximum level depends on the configuration)\n```\n\nMake the user eligible to receive experience points:\n\n```php\n    \u003c?php\n\n    $user = User::find(1);\n    $user-\u003eeligible(false); // default is true\n```\n\nGet user progress:\n\n```php\n    \u003c?php\n\n    $user = User::find(1);\n    $user-\u003eaddXp(300);\n    return $user-\u003eprogress;\n```\n\nUser progress return a json object like:\n\n```json\n{\n  \"level\": 3, // Current level\n  \"xp\": 36, // Current xp for current level\n  \"next_level_xp\": 172, // XP for the next level\n  \"next_level\": 10, // Next level\n  \"progress\": 20.93, // Current level progress\n  \"max_level\": false // If the user has the maximum level\n}\n```\n\nReset user progress:\n\n```php\n    \u003c?php\n\n    $user = User::find(1);\n    $user-\u003ereset();\n```\n\nGet user rank:\n\n```php\n \u003c?php\n\n    $user = User::find(1);\n    return $user-\u003erank; // Return user rank or use @userRank directive\n```\n\nGet the leaderboard for all users using leaderboard() method or @leaderboard directive or accessing the /leaderboard route (publish the views to update the leaderboard view)\n\n```php\n \u003c?php\n\n    $user = User::leaderboard(); // Returns all users sorted by rank\n```\n\nGet user badges:\n\n```php\n \u003c?php\n\n    $user = User::find(1);\n    return $user-\u003ebadges;\n```\n\nNote: The level will be generated automatically based on the amount of XP, so there is no method to add levels.\n\n## Badges\n\nTo create badges Gamio has an artisan command to make this easier for you, just run:\n\n```sh\n    php artisan gamio:badge\n\n    What's badge name?:\n    \u003e Gamio\n\n    What's level user gain this badge?:\n    \u003e 10\n\n    Do you want to create this badge? (yes/no) [yes]:\n    \u003e yes\n```\n\nThe badge will be created in: \u003cyour_project_folder\u003e\\App\\Gamio\\Badges\\GamioBadge.php\n\nAll badges will have the suffix \"Badge\" and when creating a new badge Gamio will create the file Badges/UserBadges.php:\n\n```php\n    \u003c?php\n\n    namespace App\\Gamio\\Badges;\n\n    class UserBadges\n    {\n        // This function returns all the badges you have created.\n        public function getData()\n        {\n            return [\n                \"gamio\" =\u003e \\App\\Gamio\\Badges\\GamioBadge::class, // The created badge class\n                // ...other badges\n            ];\n        }\n    }\n\n```\n\nThe badge file will contain the following code:\n\n```php\n    \u003c?php\n\n    namespace App\\Gamio\\Badges;\n\n    // Import the default Gamio Badge\n    use Bnacci\\Gamio\\Badge;\n\n    class TesteBadge extends Badge\n    {\n        protected $gainIn = 90; // Level you set when creating the badge. If needed, you can change it here\n        protected $id = \"gamio\"; // The ID is generated based on your name. If you need a new ID, change it here.\n        protected $name = \"Gamio\"; // The name you set when creating the badge.  If needed, you can change it here\n\n        // If your badge has an icon, put its URL here.\n        public function icon() : string | null {\n            return null;\n        }\n    }\n\n```\n\nHow to use badges:\n\nYou 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 😉.\n\n## Contributing\n\nThank you for considering contributing to Gamio!\nFork the repo, create a branch, make your changes, and submit a PR.\n\n## License\n\nThis package is open-sourced software licensed under the [MIT license](https://choosealicense.com/licenses/mit/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnacci%2Fgamio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbnacci%2Fgamio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnacci%2Fgamio/lists"}