deannv/php-gachapon
最新稳定版本:v1.0.5
Composer 安装命令:
composer require deannv/php-gachapon
包简介
A gachapon-like system, easy to integrate and play with.
README 文档
README
A wild, basic gachapon system that I highly doubt will be working.
Installation
Install the package
composer require deannv/php-gachapon
Basic usage
note This package only accept associative array or key value pair data.
- Simple use case
// item_name => drop_rate_in_percentage Gacha::from(['a' => 2, 'b' => 10])->pull();
or if you want to get more than 1 result
Gacha::from(['a' => 2, 'b' => 10])->pull(2);
- Using object
$data = [ ["name" => "item1", "drop_rate" => 3], ["name" => "item2", "drop_rate" => 5], ["name" => "item3", "drop_rate" => 2] ]; Gacha::from($data)->pull();
- Or just using pull
Gacha::pull(2, ['a' => 2, 'b' => 10]);
this is the result (array)
Array
(
[0] => item2
)
that's it!
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-18