Download the PHP package lzpeng/php-prize-drawer without Composer
On this page you can find all versions of the php package lzpeng/php-prize-drawer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package php-prize-drawer
php-prize-drawer
抽奖组件, 适应日常开发中的各种抽奖场景。
特点
- 方便扩展以支持各种奖品配置来源,如本地数组、数据库、甚至第三方接口
- 支持多种奖品类型:Dummy(“假”的奖品,如“谢谢参与”)、Normal(普通奖品,用户线下兑奖)、扩展型奖品(需要调用第三方接口的,如红包、话费充值等)
- 方便通过配置实现多种奖品分配规则,如 在指定时间才能抽中“真”奖品、按天数平均分配奖品数量等
- 支持多种抽奖策略,如随机返回一个奖品、按机率返回一个奖品等
- 高度抽象、方便扩展
环境需求
- php >=7.0
安装
composer require "lzpeng/php-prize-drawer:1.0.*"
使用方式
扩展
自定义抽奖策略
- 实现接口 \Lzpeng\PrizeDrawer\Contracts\StrategyInterface
- 注册 Factory::registerStrategy('策略名称', function($params) { return new CustomStrategy($params); });
自定义过滤器
- 实现接口 \Lzpeng\PrizeDrawer\Contracts\PrizesFilterInterface
- 注册 Factory::registerPrizesFilter('过滤器名称', function($params) { return new CustomPrizesFilter($params); });
自定义奖品配置提供器
- 实现接口 \Lzpeng\PrizeDrawer\Contracts\PrizesConfigProviderInterface
- 注册 Factory::registerPrizesConfigProvider('提供器名称', function($params) { return new CustomPrizesConfigProvider($params); });
自定义已抽数量存取器
- 实现接口\Lzpeng\PrizeDrawer\Contracts\PrizeQuantiyOfDrawAccessorInterface
- 注册 Factory::registerPrizeQuantiyOfDrawAccessor('存取器名称', function($params) { return new CustomPrizeQuantiyOfDrawAccessor($params); });
License
MIT
All versions of php-prize-drawer with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.0
The package lzpeng/php-prize-drawer contains the following files
Loading the files please wait ....