Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kosatyi/datamodel

PHP data access and serving class
https://github.com/kosatyi/datamodel

datamodel php

Last synced: 11 days ago
JSON representation

PHP data access and serving class

Awesome Lists containing this project

README

        

# DataModel

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

```php
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');
```