kosatyi/datamodel

PHP data access and serving class

v0.0.5 2020-12-26 21:29 UTC

README

PHP data access and serving class

If you just want to access the array of model data from the context of a container object, you should use either the attr method

    use Kosatyi\DataModel as Model;
    $model = new Model();
    $model->data([
        'prop' => 'value',
        'list' => [
            'item0','item1','item2'
        ],
        'map'  = [
            'prop1'=> 'value1',
            'prop2'=> 'value2' 
        ]
    ]);
    echo $model->attr('prop1');
    echo $model->attr('list.0');
    echo $model->attr('map.prop1');
    $model->attr('list.1','item1-changed');
    $model->attr('prop','value-changed');
    $model->attr('map.prop2','value2');