PHP code example of jtrw / utils

1. Go to this page and download the library: Download jtrw/utils 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/ */

    

jtrw / utils example snippets


use Jtrw\Utils\ValuesObject;

class UserValuesObject extends ValuesObject
{
    public function getID()
    {
        return $this->get('id');
    }

    public function getName()
    {
        return $this->get('name');
    }
}

$user = [
    'id'   => 1,
    'name' => 'Test User'
];

$userValuesObject = new UserValuesObject($user);

echo $userValuesObject->getName();