PHP code example of naffiq / php-randomorg-draws

1. Go to this page and download the library: Download naffiq/php-randomorg-draws library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

naffiq / php-randomorg-draws example snippets




$service = new \naffiq\randomorg\DrawService('random.org_login', 'random.org_password');
$draw = $service->newDraw(
    'Title',                                    // Name of the draw
    1,                                          // ID of created draw, which will be passed to random.org
    ['[email protected]', '[email protected]'],   // You can provide any unique identifiers of your participants
    1,                                          // Winners count 
    'test'                                      // Use 'private' or 'public' in production
    );

$draw->pushEntry('[email protected]'); // Adds new entry



/**
 * @var $service \naffiq\randomorg\DrawService
 * @var $draw \naffiq\randomorg\Draw
 */
$response = $service->holdDraw($draw);

var_dump($response->getWinners()); // Will output all winners of created draw
bash
$ composer