1. Go to this page and download the library: Download tmilos/value 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/ */
tmilos / value example snippets
class IntValue extends AbstractValue
{
public static function isValid($value)
{
return is_int($value);
}
}
$x = new IntValue(10); // ok
print $x->getValue(); // 10
$y = new IntValue(10);
var_dump($x->equal($y)); // true
$z = new IntValue('20'); // throws \UnexpectedValueException