deannv/php-gachapon 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

  1. 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);
  1. Using object
$data = [
    ["name" => "item1", "drop_rate" => 3],
    ["name" => "item2", "drop_rate" => 5],
    ["name" => "item3", "drop_rate" => 2]
];

Gacha::from($data)->pull();
  1. 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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-18