{"id":16467256,"url":"https://github.com/irfaardy/php-gacha","last_synced_at":"2025-03-16T18:31:28.452Z","repository":{"id":56993439,"uuid":"237352695","full_name":"irfaardy/php-gacha","owner":"irfaardy","description":"🎲 Simple Items or coupons Gacha / Lottery plugin with PHP, game backend gacha","archived":false,"fork":false,"pushed_at":"2022-04-22T02:27:01.000Z","size":137,"stargazers_count":35,"open_issues_count":1,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T12:08:32.534Z","etag":null,"topics":["anime","dice","example","fate-grand-order","fgo","fun","gacha","gacha-simulator","game","irfa","items","php","plugin","roll","roulette","roulette-wheel","simple","simulator","spin","summon"],"latest_commit_sha":null,"homepage":"","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/irfaardy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"irfa","ko_fi":"irfaardy","custom":["https://buymeacoff.ee/irfaardy"]}},"created_at":"2020-01-31T03:24:37.000Z","updated_at":"2025-01-06T03:46:32.000Z","dependencies_parsed_at":"2022-08-21T10:40:39.578Z","dependency_job_id":null,"html_url":"https://github.com/irfaardy/php-gacha","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irfaardy%2Fphp-gacha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irfaardy%2Fphp-gacha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irfaardy%2Fphp-gacha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irfaardy%2Fphp-gacha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/irfaardy","download_url":"https://codeload.github.com/irfaardy/php-gacha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826788,"owners_count":20354220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["anime","dice","example","fate-grand-order","fgo","fun","gacha","gacha-simulator","game","irfa","items","php","plugin","roll","roulette","roulette-wheel","simple","simulator","spin","summon"],"created_at":"2024-10-11T11:46:43.070Z","updated_at":"2025-03-16T18:31:27.759Z","avatar_url":"https://github.com/irfaardy.png","language":"PHP","readme":"\u003ch2\u003e🎲Simple Items Gacha with PHP\u003ch2\u003e\n\n[![Code Climate Maintainabillity](https://codeclimate.com/github/irfaardy/php-gacha/badges/gpa.svg)](https://codeclimate.com/github/irfaardy/php-gacha) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/irfaardy/php-gatcha/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/irfaardy/php-gatcha/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/irfaardy/php-gatcha/badges/build.png?b=master)](https://scrutinizer-ci.com/g/irfaardy/php-gatcha/build-status/master) [![Latest Stable Version](https://poser.pugx.org/irfa/php-gatcha/v/stable)](https://packagist.org/packages/irfa/php-gatcha) [![License](https://poser.pugx.org/irfa/php-gatcha/license)](https://packagist.org/packages/irfa/php-gatcha) ![PHP Composer](https://github.com/irfaardy/php-gacha/workflows/PHP%20Composer/badge.svg) [![time tracker](https://wakatime.com/badge/github/irfaardy/php-gacha.svg)](https://wakatime.com/badge/github/irfaardy/php-gacha)\n\n\n\u003ca href=\"https://www.buymeacoffee.com/irfaardy\" target=\"_blank\"\u003e\u003cimg width=\"130px\" src=\"https://cdn.buymeacoffee.com/buttons/lato-red.png\" alt=\"Buy Me A Coffee\"  \u003e\u003c/a\u003e\n\n\u003cbr\u003e\n\u003ch4\u003eThis package is useful for making gacha or lottery for shopping coupons, game items, etc. with the percentage of possibilities that you have specified\u003c/h4\u003e\u003cbr\u003e\n\u003ch3\u003e🛠️ Installation with Composer \u003c/h3\u003e\n\n```php\ncomposer require irfa/php-gatcha\n```\n\n\u003eYou can get Composer [ here]( https://getcomposer.org/download/)\n\u003ch3\u003e Usage in Laravel\u003c/h3\u003e\nOpen config/app.php\u003cbr\u003e add aliases (optional)\n\n```php\n'aliases' =\u003e [\n\t\t   ...\n\t\t  'Gatcha' =\u003e Irfa\\Gatcha\\Roll::class,\n\t\t   ...\n\t     ];\n```\n**Example:**\n\n```php\n...\nuse Gatcha\n\n class Example {\n\t  function index()\n\t  {\n\t     return Gatcha::put([ 'Item 1' =\u003e 29.4,  'Item 2' =\u003e 0.3])-\u003espin();\n\t  }\n }\n \n```\n\n\u003ch3\u003eUsage in PHP Native\u003c/h3\u003e\n\n```php\nrequire_once \"vendor/autoload.php\";\nuse Irfa\\Gatcha\\Roll;`\n```\n\n\n\n\u003ch3\u003e💻 Basic Usage\u003c/h3\u003e\n\n\n```php\n    $items = [\n\t\t'common ITEM1' =\u003e 70, // 70% chance\n\t       \t'Rare ITEM 2' =\u003e 29.4, // 29.4% chance\n\t       \t'Super Rare ITEM' =\u003e 0.3, // 0.3% chance\n\t       \t'Super Rare  ITEM 2' =\u003e 0.3,\n\t       \t'Super Super Rare  ITEM' =\u003e 0.003, // 0.003% chance\n\t     ];\n\t  \n    $item_get = Roll::put($items)-\u003espin();\n    echo \"Congratulations you get \".$item_get;\n```\n\n\u003ch3\u003e💻 Using DropUp\u003c/h3\u003e\n\n\u003e This function is used for certain conditions such as events, bonuses, etc.\n\n```php\nuse Irfa\\Gatcha\\Roll;\n$items = [\n\t\t'common ITEM1' =\u003e 70, // 70% chance\n\t       \t'Rare ITEM 2' =\u003e 29.4, // 29.4% chance\n\t       \t'Super Rare ITEM' =\u003e 0.3, // 0.3% chance\n\t       \t'Super Rare  ITEM 2' =\u003e 0.3,\n\t       \t'Super Super Rare  ITEM' =\u003e 0.003, // 0.003% chance\n\t  ];\n\t  \n\t Roll::put($items)\n\t if(date('Y-m-d') == '2020-03-21') //example event date\n\t {\n\t    Roll::dropUp(['Super Rare ITEM', 'Super Rare  ITEM 2'], 200)//Drop up rate 200%\n\t    -\u003edropUp('common ITEM1', 300); //Drop up rate 300%\n\t    //Parameters items (items index in array), rate in percent\n\t }\n\t \n\t $item_get = Roll::spin();\n\t \n\t echo \"Congratulations you get \".$item_get;\n```\n\u003ch3\u003e💻 JSON Return\u003c/h3\u003e\n\n\u003e If you want return to json\n\n```php\nRoll::put($items)-\u003ejsonSpin();\n```\n**Result:**\n\n```json\n{\n  \"data\":{\n\t  \"item\":\"SomeItem\"\n\t }\n}\n```\n## How to Contributing?\n\n1. Fork it (\u003chttps://github.com/irfaardy/php-gatcha/fork\u003e)\n2. Commit your changes (`git commit -m 'some New Feature'`)\n3. Push to the branch (`git push origin x.x`)\n4. Create a new Pull Request\n\n***\n---\n## Issue\nIf you found issues or bug please create new issues here https://github.com/irfaardy/php-gacha/issues/new\n***\n\n","funding_links":["https://patreon.com/irfa","https://ko-fi.com/irfaardy","https://buymeacoff.ee/irfaardy","https://www.buymeacoffee.com/irfaardy"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firfaardy%2Fphp-gacha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firfaardy%2Fphp-gacha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firfaardy%2Fphp-gacha/lists"}