PHP code example of best-served-cold / phalue-objects

1. Go to this page and download the library: Download best-served-cold/phalue-objects 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/ */

    

best-served-cold / phalue-objects example snippets


//...
public function double() 
{
    return new static($this->getValue() * 2);
}
...//

//...
public static function fromVars($one = 1, $two = 2, $three = 3)
{
    return new static([$one, $two, $three]); 
}
...//

//...
$bob = $stringValueObject->equals($csvValueObject);
...//

new SomeClass('value');

SomeClass::fromSomeObject($someObject);

$someObject->toArray();