abmmhasan / game-draw
This package is abandoned and no longer maintained.
The author suggests using the infocyph/game-draw package instead.
Generates Item and Item count for winners.
4.1.2
2026-05-06 05:43 UTC
Requires
- php: >=8.2
- ext-bcmath: *
- psr/cache: ^3.0
Requires (Dev)
- infocyph/phpforge: dev-main
README
Unified PHP draw engine with a single request/response contract for item, user, and campaign draw methods.
Campaign state uses PSR-6 (Psr\Cache\CacheItemPoolInterface) via options.cachePool.
Install
Requirements:
- PHP 8.2+
ext-bcmath
composer require infocyph/game-draw
Quick Example
<?php use Infocyph\Draw\Draw; $draw = new Draw(); $result = $draw->execute([ 'method' => 'lucky', 'items' => [ ['item' => 'gift_a', 'chances' => 10, 'amountMode' => 'list', 'amounts' => [1, 2]], ['item' => 'gift_b', 'chances' => 20, 'amountMode' => 'weighted', 'amounts' => ['5' => 0.25, '10' => 0.75]], ], 'options' => ['count' => 2], ]);
Supported Methods
luckygrandprobability,elimination,weightedElimination,roundRobin,cumulativebatched,timeBased,weightedBatch,sequential,rangeWeightedcampaign.run,campaign.batch,campaign.simulate
Documentation
Published docs: https://docs.infocyph.com/projects/Game-Draw/