romanchehh / yaroc-v4
YAROC fork for Random.org API v4 with Flexible Gambling support.
Fund package maintenance!
drupol
www.paypal.me/drupol
Installs: 15
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 2
Open Issues: 0
pkg:composer/romanchehh/yaroc-v4
Requires
- php: >= 7.4
- ext-json: *
- symfony/http-client-contracts: ^2
Requires (Dev)
- drupol/php-conventions: ^3
- friends-of-phpspec/phpspec-code-coverage: ^6.1
- infection/infection: ^0.21
- infection/phpspec-adapter: ^0.1.2
- ircmaxell/random-lib: ^1.2
- phpspec/phpspec: ^7
- rych/random: ^0.1.0
- symfony/http-client: ^4.4 || ^5.2
- vimeo/psalm: ^4.7
This package is not auto-updated.
Last update: 2025-10-14 12:29:37 UTC
README
Yet Another Random.org Client — now with Flexible Gambling Support and extended configuration capabilities.
YAROC v4 is a modern PHP client for the Random.org JSON-RPC API, providing full support for the Realise 4 endpoints.
This fork extends the original drupol/yaroc with enhanced flexibility, additional configuration options, and improved license data management.
Why Upgrade to YAROC v4
YAROC v4 introduces full support for Random.org Signed API Release 4, which is required for Flexible Gambling licenses.
Background
- Random.org informed that Release 2 of the Signed API does not properly handle Flexible Gambling licenses.
Previously, it would appear to work, but this was a bug. - Starting 15 August 2025, Release 2 will reject any API key using a Flexible Gambling license with an
API_KEY_INVALID_VERSIONerror.
What YAROC v4 Provides
- Full compatibility with Signed API Release 4.
- Mandatory
licenseDatasupport for all API calls, allowing you to provide license-specific metadata (e.g.,maxPayoutValue). - Default license payload included automatically if
licenseDatais not provided. - Seamless migration path from previous versions without breaking your existing API integration.
Note: Users with Flexible Gambling licenses must upgrade to v4 to avoid service interruptions.
Requirements
- PHP >= 7.4
- An HTTP client (recommended: symfony/http-client)
Installation
composer require romanchehh/yaroc-v4
If you don’t have an HTTP client installed yet:
composer require symfony/http-client
Usage
First request an API Key or use the temporary key.
The temporary API key used in the examples will be disabled when the beta ends.
Currently support all the Random.org API method calls in the basic and signed APIs.
Examples
Basic Example
<?php require 'vendor/autoload.php'; use Romanchehh\Yaroc\Plugin\Provider; use Romanchehh\Yaroc\RandomOrgAPI; // Create a provider for integer generation $provider = (new Provider()) ->withResource('generateIntegers') ->withParameters(['n' => 10, 'min' => 0, 'max' => 100]); // Create API client with default license data $result = (new RandomOrgAPI()) ->withApiKey('00000000-0000-0000-0000-000000000000') ->getData($provider); print_r($result);
️ Example with Custom License Data
You can provide your own license data.
Example
<?php require 'vendor/autoload.php'; use Romanchehh\Yaroc\Plugin\Provider; use Romanchehh\Yaroc\RandomOrgAPI; // Prepare provider for generating random strings $provider = (new Provider()) ->withResource('generateStrings') ->withParameters([ 'n' => 5, 'length' => 10, 'characters' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' ]); // Initialize API client with your API key and license metadata $api = (new RandomOrgAPI()) ->withApiKey('your-api-key') ->withLicenseData([ 'maxPayoutValue' => [ 'currency' => 'USD', 'amount' => 99, ], ]); // Send request and print the response $result = $api->getData($provider); print_r($result);