1. Go to this page and download the library: Download rs/dice 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/ */
rs / dice example snippets
class A {
public $b;
public function __construct(B $b) {
$this->b = $b;
}
}
class B {
}
$rule->substitutions['A'] = function() {
return new A;
};
$rule->call[] = ['someMethod', function() {
// '2' will be provided as the first argument when someMethod is called
return 2;
}];
$rule->constructParams[] = function() {
//'abc' will be providedas the first constructor parameter
return 'abc';
};
$rule->substitutions['A'] = new \Dice\Instance(function() {
return new A;
});
$rule->call[] = ['someMethod', new \Dice\Instance(function() {
// '2' will be provided as the first argument when someMethod is called
return 2;
}]);
$rule->constructParams[] = new \Dice\Instance(function() {
//'abc' will be providedas the first constructor parameter
return 'abc';
});
new Dice => new \Dice\Dice
new DiceInstance => new \Dice\Instance
new DiceRule => new \Dice\Rule
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.