{"id":18546777,"url":"https://github.com/nabeghe/levex-php","last_synced_at":"2026-01-28T18:07:01.384Z","repository":{"id":257826267,"uuid":"872596741","full_name":"nabeghe/levex-php","owner":"nabeghe","description":"A simlpe leveling and experience (XP) system designed for PHP.","archived":false,"fork":false,"pushed_at":"2025-07-03T12:32:47.000Z","size":14,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-16T20:47:53.926Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/nabeghe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2024-10-14T18:04:10.000Z","updated_at":"2025-07-03T12:32:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"ca4a7fe7-953f-4f7b-8d54-d3c68bd80766","html_url":"https://github.com/nabeghe/levex-php","commit_stats":null,"previous_names":["nabeghe/levex-php"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nabeghe/levex-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeghe%2Flevex-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeghe%2Flevex-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeghe%2Flevex-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeghe%2Flevex-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nabeghe","download_url":"https://codeload.github.com/nabeghe/levex-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabeghe%2Flevex-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28848417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"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":[],"created_at":"2024-11-06T20:26:56.245Z","updated_at":"2026-01-28T18:07:01.378Z","avatar_url":"https://github.com/nabeghe.png","language":"PHP","readme":"# Levex (Level + Experience)\n\n\u003e A simple leveling and XP System for PHP, Just Like in Online Games.\n\nBuilding a leveling system that showcases a user's level based on their experience points might seem like a daunting\ntask.\nBut fear not! Levex simplifies this process with just a few straightforward methods.\nYou can effortlessly implement this functionality without diving into complex calculations.\nEnjoy a seamless experience as you elevate your users’ journey!\n\n## 🫡 Usage\n\n### 🚀 Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require nabeghe/levex\n```\n\n### Instance\n\n#### Default Instance\n\nRetrieve a singleton instance with default options:\n\n```php\nuse Nabeghe\\Levex\\Levex;\n\n$levex = Levex::instance();\n```\n\n#### Custom Instance\n\nRetrieve a custom instance with custom options:\n\n```php\nuse Nabeghe\\Levex\\Levex;\n\n$options = ['baseLevelXp' =\u003e 50];\n$levex = new Levex($options);\n```\n\nOptions are related to class fields:\n\n| Name                  | Description                                                                                                                                                                                                                         |\n|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `baseLevelXp`         | XP required to reach level 1. Default `100`.                                                                                                                                                                                        |\n| `levelLogBase`        | Logarithmic base in calculating the level by XP. Default `3`.                                                                                                                                                                       |\n| `priceXpRate`         | XP rate per unit of price. For example, if the rate is 10, every 10 units of a specified price will equal 1 XP. Default `1`.                                                                                                        |\n| `godLevelSymbols`     | Symbols that indicate a level associated with the creator or God, rather than a regular level. Default `['∞']`.                                                                                                                     |\n| `negativeLevelIsGod`  | Indicates whether a negative level should be considered as the god/creator or not. Default `true`.                                                                                                                                  |\n| `levelNamesHandler`   | A callable that acts as a replacement for the determineLevelName method and takes the same input. If determineLevelName returns null, the main method will be executed. Used to customize the name/title of levels. Default `null`. | \n\n\u003chr\u003e\n\n### Global Configuration\n\nuse kyeword `const` or function `define`.\n\n| Name                          | Description                             |\n|-------------------------------|-----------------------------------------|\n| `LEVEX_BASE_LEVEL_XP`         | related to `$levex-\u003ebaseLevelXp`        |\n| `LEVEX_LEVEL_LOG_BASE`        | related to `$levex-\u003elevelLogBase`       |\n| `LEVEX_PRICE_XP_RATE`         | related to `$levex-\u003epriceXpRate`        |\n| `LEVEX_GOD_LEVEL_SYMBOLS`     | related to `$levex-\u003egodLevelSymbols`    |\n| `LEVEX_NEGATIVE_LEVEL_IS_GOD` | related to `$levex-\u003enegativeLevelIsGod` |\n\n### Methods\n\n#### `calcLevel(int $xp): int`\n\nCalculates which level corresponds to a given XP.\n\n#### `calcRequiredXpToLevel(int $level): int`\n\nCalculates the minimum XP required to reach a specified level.\n\n#### `calcRemainingXpToLevel(int $level, $currentXP, \u0026levelXP = null): int`\n\nCalculates how much XP is remaining to reach a specific level.\n\n**Notice:** The $levelXP is output of the calcRequiredXpToLevel()\n\n#### `calcRemainingPercentToLevel(int $level, int $currentXP, int \u0026$leftXP = 0): float|int`\n\nCalculates how many percent of progress reamining to reaching a specific level.\n\n**Notice:** The $levelXP is output of the remaining XP to reach the desired level.\n\n#### `calcPassedPercentToLevel(int $level, int $currentXP, int \u0026$leftXP = 0): float|int`\n\nCalculates how many percent of progress has been made towards reaching a specific level.\n\n**Notice:** The $levelXP is output of the remaining XP to reach the desired level.\n\n#### `calcXpByPrice($price, ?float $rate = null): int`\n\nCalculates how much XP can be earned from a given price.\n\nNotice: The $rate is XP rate per unit of price.\nFor example, if the rate is 10, every 10 units of a specified price will equal 1 XP.\nDefault is option 'priceXpRate'.\n\n#### `checkGodLevel($level): bool`\n\nChecks whether the level is specific to the god or not.\n\n#### `determineLevelName($level): string`\n\nRetrives the name/title of a level.\n\n## 📖 License\n\nLicensed under the MIT license, see [LICENSE.md](LICENSE.md) for details.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabeghe%2Flevex-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnabeghe%2Flevex-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabeghe%2Flevex-php/lists"}