PHP code example of xakepehok / value-object-builder

1. Go to this page and download the library: Download xakepehok/value-object-builder 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/ */

    

xakepehok / value-object-builder example snippets



$value = $_POST['value'] ?? null;
$object = $value ? new Object($value) : null;


use \XAKEPEHOK\ValueObjectBuilder\VOB;

$object = VOB::build(Object::class, $_POST['value'] ?? null);


$value_1 = $_POST['value_1'] ?? null;
$value_2 = $_POST['value_2'] ?? null;
$value_3 = $_POST['value_3'] ?? null;

$object = null;
if (!is_null($value_1) || !is_null($value_2) || !is_null($value_3)) {
    $object = new Object($value_1, $value_2, $value_3);
}


use \XAKEPEHOK\ValueObjectBuilder\VOB;

$object = VOB::buildFromValues(Object::class, [$_POST['value_1'] ?? null, $_POST['value_2'] ?? null, $_POST['value_3'] ?? null]);