PHP code example of somnambulist / attribute-model
1. Go to this page and download the library: Download somnambulist/attribute-model 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/ */
somnambulist / attribute-model example snippets
use Somnambulist\Components\AttributeModel\AbstractModel;
use Somnambulist\Components\AttributeModel\AttributeCaster;
use Somnambulist\Components\AttributeModel\TypeCasters\AreaCaster;
use Somnambulist\Components\AttributeModel\TypeCasters\MoneyCaster;
class User extends AbstractModel
{
}
$caster = new AttributeCaster([
new AreaCaster(),
new MoneyCaster(),
]);
$attrs = [];
$user = new User($caster->cast($attrs, ['area' => 'area', 'money' => 'money',]));