PHP code example of pattisahusiwa / dice-wrapper
1. Go to this page and download the library: Download pattisahusiwa/dice-wrapper 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/ */
pattisahusiwa / dice-wrapper example snippets
// Create new Dice instance
$dice = new Dice();
// You can also pass your dependencies configuration into Dice instance
$dice = $dice->addRules('rules.json');
// Pass dice instance to DiceWrapper
$diceWrapper = new DiceWrapper($dice);
// example usage
if ($diceWrapper->has('class_name')) {
$object = $diceWrapper->get('class_name');
}
use Psr\Container\ContainerInterface;
final class ExampleClass
{
public function __construct(ContainerInterface $dic)
{
}
}