danielsonsilva/diceroller
Composer 安装命令:
composer require danielsonsilva/diceroller
包简介
Package to work with customized dice rolling and getting the results from them
README 文档
README
Were you searching for an easy way to roll that dice with PHP? Well, you've found the right package for you. You'll have the object representation to add rolls and modify them. Create, add rolls and roll to know the results.
It is as simples as this:
use danielsonsilva\DiceRoller\DiceRoller;
// Create your object
$diceRoller = new DiceRoller();
// Add dice into the roller
$dice->addDice(3, 4); // adds 3 d4 dice
$dice->addDice(1, 20); // adds 1 d20 die
// Apply modifier if you wish
$dice->addValue(5); // adds a +5 into the roll
// Or you can subtract from that added modifier
$dice->subtractValue(7); // the roll modifier becomes -2
// Then roll to know the results
$rollResult = $dice->roll();
// Get the string result, in this case could be
// 3d4 (2 + 1 + 4) + 1d20 (18)
$stringResult = $dice->getResultString();
Now you can use as a package and do some dice rolling.
Version History
v 1.4.1
- Tests were made in php 7.3.27
v 1.4.0
- After the roll, a result string showing each result from each group dice
- Unit tests added to check the new features
v 1.4.0
- After the roll, a result string showing each result from each group dice
- Unit tests added to check the new features
v 1.3.0
- Downgraded the minimum version of PHP required to use this package from 7.4 to 7.3
v 1.2.0
- Features added: isEmpty and set and get modifier to change the modifier completely;
- Unit tests added to check the new features.
v 1.1.0
- Features added: string representation of the DiceRoller (__toString())
- Unit tests improved to check the minimum and maximum values from a roll
v 1.0.0
- Package danielsonsilva/diceroller created;
- Features: roll, addDice, addValue and subtractValue;
- Unit tests to check its effectiveness
danielsonsilva/diceroller 适用场景与选型建议
danielsonsilva/diceroller 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 danielsonsilva/diceroller 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 danielsonsilva/diceroller 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-22