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.
Requirements:
- PHP 8.4+
ext-bcmath
composer require infocyph/game-draw<?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],
]);luckygrandprobability,elimination,weightedElimination,roundRobin,cumulativebatched,timeBased,weightedBatch,sequential,rangeWeightedcampaign.run,campaign.batch,campaign.simulate
Published docs: https://docs.infocyph.com/projects/Game-Draw/