1. Go to this page and download the library: Download yrizos/bucket 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/ */
yrizos / bucket example snippets
class MyContainer implements Bucket\Container\MagicArrayContainerInterface
{
use Bucket\Container\MagicArrayContainerTrait;
}
$myContainer = new MyContainer();
$myContainer->label = "hello world";
echo $myContainer["label"];
$bucket = new Bucket\Bucket();
$bucket->onGet("name", function ($value) {
return trim($value);
});
$bucket->onSet("email", function ($value) {
if (!filter_var($value, FILTER_VALIDATE_EMAIL))
throw new \InvalidArgumentException();
return filter_var($value, FILTER_SANITIZE_EMAIL);
});
$bucket->name = " Yannis ";
var_dump($bucket->name); // string 'Yannis' (length=6)
$bucket->email = 42; // will fail
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.