PHPackages                             irfa/php-gatcha - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. irfa/php-gatcha

ActivePackage[Utility &amp; Helpers](/categories/utility)

irfa/php-gatcha
===============

Simple Items Gatcha with PHP

v2.1(5y ago)362.4k16[1 issues](https://github.com/irfaardy/php-gacha/issues)MITPHPPHP &gt;=5.4.0

Since Feb 19Pushed 4y ago3 watchersCompare

[ Source](https://github.com/irfaardy/php-gacha)[ Packagist](https://packagist.org/packages/irfa/php-gatcha) Fund[ GitHub Sponsors](https://github.com/irfaardy)[ RSS](/packages/irfa-php-gatcha/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)DependenciesVersions (7)Used By (0)

🎲Simple Items Gacha with PHP
----------------------------

[](#simple-items-gacha-with-php)

[![Code Climate Maintainabillity](https://camo.githubusercontent.com/b1a5ab7a6c464bf91e3486ee6233e2cdc2d98cfc9bbfebec1f756451b9b85af2/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f69726661617264792f7068702d67616368612f6261646765732f6770612e737667)](https://codeclimate.com/github/irfaardy/php-gacha) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/db4552f96001b582c6b94e186b092354911e6b76727118b05ab4661676e73ded/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f69726661617264792f7068702d6761746368612f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/irfaardy/php-gatcha/?branch=master) [![Build Status](https://camo.githubusercontent.com/c8ef44d1fbb04552e07a26426affa4e3ef9190c4088daa8f61a616217b1731b6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f69726661617264792f7068702d6761746368612f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/irfaardy/php-gatcha/build-status/master) [![Latest Stable Version](https://camo.githubusercontent.com/213b70336f6b23439392602a22661e30267a3f290d7cc61e56b0148c9cf13d58/68747470733a2f2f706f7365722e707567782e6f72672f697266612f7068702d6761746368612f762f737461626c65)](https://packagist.org/packages/irfa/php-gatcha) [![License](https://camo.githubusercontent.com/89d061427a1a4f96df6ffe35d0fd3ae92a3da0e83be36c5e9b165d3ac54d8326/68747470733a2f2f706f7365722e707567782e6f72672f697266612f7068702d6761746368612f6c6963656e7365)](https://packagist.org/packages/irfa/php-gatcha) [![PHP Composer](https://github.com/irfaardy/php-gacha/workflows/PHP%20Composer/badge.svg)](https://github.com/irfaardy/php-gacha/workflows/PHP%20Composer/badge.svg) [![time tracker](https://camo.githubusercontent.com/550e43e1dd91bc51f7094b0dfd21b15620a00417bc1d8a823d36a72f954fbcb5/68747470733a2f2f77616b6174696d652e636f6d2f62616467652f6769746875622f69726661617264792f7068702d67616368612e737667)](https://wakatime.com/badge/github/irfaardy/php-gacha)

[![Buy Me A Coffee](https://camo.githubusercontent.com/6fa04566eafad07c2855eed9aa6500f8e07736eab65d13450d603194f54bc181/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f6c61746f2d7265642e706e67)](https://www.buymeacoffee.com/irfaardy)

[](#------)

#### This package is useful for making gacha or lottery for shopping coupons, game items, etc. with the percentage of possibilities that you have specified

[](#this-package-is-useful-for-making-gacha-or-lottery-for-shopping-coupons-game-items-etc-with-the-percentage-of-possibilities-that-you-have-specified)

### 🛠️ Installation with Composer

[](#️-installation-with-composer-)

```
composer require irfa/php-gatcha
```

> You can get Composer [ here](https://getcomposer.org/download/)

###  Usage in Laravel

[](#-usage-in-laravel)

Open config/app.php
 add aliases (optional) ```
'aliases' => [
		   ...
		  'Gatcha' => Irfa\Gatcha\Roll::class,
		   ...
	     ];
```

**Example:**

```
...
use Gatcha

 class Example {
	  function index()
	  {
	     return Gatcha::put([ 'Item 1' => 29.4,  'Item 2' => 0.3])->spin();
	  }
 }

```

### Usage in PHP Native

[](#usage-in-php-native)

```
require_once "vendor/autoload.php";
use Irfa\Gatcha\Roll;`
```

### 💻 Basic Usage

[](#-basic-usage)

```
    $items = [
		'common ITEM1' => 70, // 70% chance
	       	'Rare ITEM 2' => 29.4, // 29.4% chance
	       	'Super Rare ITEM' => 0.3, // 0.3% chance
	       	'Super Rare  ITEM 2' => 0.3,
	       	'Super Super Rare  ITEM' => 0.003, // 0.003% chance
	     ];

    $item_get = Roll::put($items)->spin();
    echo "Congratulations you get ".$item_get;
```

### 💻 Using DropUp

[](#-using-dropup)

> This function is used for certain conditions such as events, bonuses, etc.

```
use Irfa\Gatcha\Roll;
$items = [
		'common ITEM1' => 70, // 70% chance
	       	'Rare ITEM 2' => 29.4, // 29.4% chance
	       	'Super Rare ITEM' => 0.3, // 0.3% chance
	       	'Super Rare  ITEM 2' => 0.3,
	       	'Super Super Rare  ITEM' => 0.003, // 0.003% chance
	  ];

	 Roll::put($items)
	 if(date('Y-m-d') == '2020-03-21') //example event date
	 {
	    Roll::dropUp(['Super Rare ITEM', 'Super Rare  ITEM 2'], 200)//Drop up rate 200%
	    ->dropUp('common ITEM1', 300); //Drop up rate 300%
	    //Parameters items (items index in array), rate in percent
	 }

	 $item_get = Roll::spin();

	 echo "Congratulations you get ".$item_get;
```

### 💻 JSON Return

[](#-json-return)

> If you want return to json

```
Roll::put($items)->jsonSpin();
```

**Result:**

```
{
  "data":{
	  "item":"SomeItem"
	 }
}
```

How to Contributing?
--------------------

[](#how-to-contributing)

1. Fork it ()
2. Commit your changes (`git commit -m 'some New Feature'`)
3. Push to the branch (`git push origin x.x`)
4. Create a new Pull Request

---

---

Issue
-----

[](#issue)

If you found issues or bug please create new issues here

---

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~67 days

Recently: every ~84 days

Total

6

Last Release

1979d ago

Major Versions

v1.0.x-dev → v2.02020-03-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/371ddbe81fee5daf2246e1e6cea85792b76f7042ec9232c36e84870de4b2a37b?d=identicon)[irfaardy](/maintainers/irfaardy)

---

Top Contributors

[![irfaardy](https://avatars.githubusercontent.com/u/49023326?v=4)](https://github.com/irfaardy "irfaardy (102 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (5 commits)")

---

Tags

animediceexamplefate-grand-orderfgofungachagacha-simulatorgameirfaitemsphppluginrollrouletteroulette-wheelsimplesimulatorspinsummonphpgameSSRprobabilityspingachaphp-gatcharoulette

### Embed Badge

![Health badge](/badges/irfa-php-gatcha/health.svg)

```
[![Health](https://phpackages.com/badges/irfa-php-gatcha/health.svg)](https://phpackages.com/packages/irfa-php-gatcha)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21422.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
