Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/kosatyi/datamodel
- Owner: kosatyi
- Created: 2018-03-27T08:59:08.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-15T23:52:10.000Z (over 1 year ago)
- Last Synced: 2024-12-08T01:47:13.064Z (about 1 month ago)
- Topics: datamodel, php
- Language: PHP
- Homepage: https://kosatyi.com/datamodel/
- Size: 65.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
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');
```