{"id":33956039,"url":"https://github.com/granam/dice-rolls","last_synced_at":"2026-05-29T08:02:32.518Z","repository":{"id":29640538,"uuid":"33181911","full_name":"granam/dice-rolls","owner":"granam","description":"Wanna random number? And what about dices, six-sides, ten-sided, seventy-five sided, whatever?","archived":false,"fork":false,"pushed_at":"2021-03-24T09:35:31.000Z","size":264,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-20T06:59:20.122Z","etag":null,"topics":["dice","numbers","php","random","roll"],"latest_commit_sha":null,"homepage":"https://www.drdplus.info","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/granam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-31T11:34:48.000Z","updated_at":"2021-08-30T18:42:20.000Z","dependencies_parsed_at":"2022-08-21T07:10:26.396Z","dependency_job_id":null,"html_url":"https://github.com/granam/dice-rolls","commit_stats":null,"previous_names":["granam/granam-dice-rolls"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/granam/dice-rolls","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/granam%2Fdice-rolls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/granam%2Fdice-rolls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/granam%2Fdice-rolls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/granam%2Fdice-rolls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/granam","download_url":"https://codeload.github.com/granam/dice-rolls/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/granam%2Fdice-rolls/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33642318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dice","numbers","php","random","roll"],"created_at":"2025-12-12T20:17:36.622Z","updated_at":"2026-05-29T08:02:32.500Z","avatar_url":"https://github.com/granam.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/jaroslavtyc/drd-dice-roll.svg?branch=master)](https://travis-ci.org/jaroslavtyc/drd-dice-rolls)\n[![Test Coverage](https://codeclimate.com/github/jaroslavtyc/drd-dice-roll/badges/coverage.svg)](https://codeclimate.com/github/jaroslavtyc/drd-dice-rolls/coverage)\n[![License](https://poser.pugx.org/drd/dice-rolls/license)](https://packagist.org/packages/drd/dice-rolls)\n\n[Let's roll!](#lets-roll)\n\n[Custom dices \u0026 rolls](#custom-dices--rolls)\n\n[Install](#install)\n\n## Let's roll!\n\n```php\n\u003c?php\nuse Granam\\DiceRolls\\Templates\\Rollers\\Roller1d6;\nuse Granam\\DiceRolls\\Templates\\Rollers\\Roller2d6DrdPlus;\n\n$roller1d6 = new Roller1d6();\n$rolledValue = $roller1d6-\u003eroll();\nif ($rolledValue === 6) {\n    echo 'Hurray! You win!';\n} else {\n    echo 'Try harder';\n}\n\n$roller2d6Granam = new Roller2d6DrdPlus();\nwhile (($roll = $roller2d6Granam-\u003eroll()) \u0026\u0026 $roll-\u003egetValue() \u003c= 12) {\n    echo 'Still no bonus :( ...';\n}\necho 'There it is! Bonus roll comes, with final value of '\n. $roll-\u003egetValue() . '\nRolls were quite dramatic, consider by yourself: ';\nforeach ($roll-\u003egetDiceRolls() as $diceRoll) {\n    echo 'Rolled number ' . $diceRoll-\u003egetRolledNumber() . ', evaluated as value ' . $diceRoll-\u003egetValue(); \n}\n```\nThere are plenty of predefined templates of dices and rolls as 1d4, 1d6, 1d10.\nYou can mix those and any else you create by `CustomDice` class.\n\nJust think about your needs and check templates. Your requirements may be already satisfied by them.\n\n\n## Custom dices \u0026 rolls\nThere can be situations, where you need crazy combinations. Let's say one roll with 1d5 dice and three rolls with 1d74 dice.\n\nIt is easy. The hard part is only to find the way:\n```php\n\u003c?php\nuse Granam\\DiceRolls\\Templates\\Dices\\CustomDice;\nuse Granam\\Integer\\IntegerObject;\nuse Granam\\DiceRolls\\Templates\\Dices\\Dices;\nuse Granam\\DiceRolls\\Roller;\nuse Granam\\DiceRolls\\Templates\\Evaluators\\OneToOneEvaluator;\nuse Granam\\DiceRolls\\Templates\\RollOn\\NoRollOn;\n\n$dice1d5 = new CustomDice(new IntegerObject(1) /* minimum of the dice */, new IntegerObject(5) /* maximum of the dice */);\n$dice1d74 = new CustomDice(new IntegerObject(1) /* minimum of the dice */, new IntegerObject(74) /* maximum of the dice */);\n$diceCombo = new Dices([$dice1d5, $dice1d74, $dice1d74, $dice1d74]);\n\n$roller = new Roller(\n    $diceCombo,\n    new IntegerObject(1) /* roll with them all just once */,\n    new OneToOneEvaluator() /* \"what you roll is what you get\" */,\n    new NoRollOn() /* no bonus roll at all */,\n    new NoRollOn() /* no malus roll at all */\n);\n\n// here it is!\n$roller-\u003eroll();\n\n```\n\n## Install\n- order [composer](https://getcomposer.org/download/) to add new requirement\n```\ncomposer require drd/dice-roll\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgranam%2Fdice-rolls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgranam%2Fdice-rolls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgranam%2Fdice-rolls/lists"}