Universeorange.com/Docs/
The
Data class
has these methods.
Data::parameter($data, $parameter='', $offset=0);
<name> test test2 test.csv
Data::parameter($object->request(), 'test2', -1);
This will result in test
.
Data::parameter($object->request(), 'test', 2);
This will result in test.csv
.
$data = new Data();
$data->data(String $attribute, $value=null, $type='');
$data->data('set', 'attribute', 'value');
$data->data('get', 'attribute');
$data->data('delete', 'attribute');
$data->data('attribute'); //get attribute
$data->data('attribute', 'value'); //set attribute with value
$data = new Data();
$data->delete(String $attribute);
$data = new Data();
$data->get(String $attribute);
$data = new Data();
$data->set(String $attribute, $value=null);
$data = new Data();
$data->write(String $url);
Writes the data as a .json
file.
Where User.json
looks like:
{
"user": {
"1" : {
"id": 1,
"name": "John",
"password": "...",
...
},
"2" : ...
}
}
<?php
use R3m\Io\Module\Core;
use R3m\Io\Module\Data;
use R3m\Io\Module\File;
$url = 'User.json';
$data = new Data();
$read = File::read($url);
$read = Core::object($read, Core::OBJECT_OBJECT);
$data->data($read);
$john = $data->get('user.1.name'); //or
$john = $data->data('user.1.name');
$list = $data->get('user');
foreach($list as $user){
d($user->id); // debug id
d($user->name); // debug name
d($user->password); //debug password
$data->set('user.1.password', '...'); //sets new password for user 1
$data->delete('user.2'); // deletes 'user.2' from user object
}
Last modified: 2021-06-07
© 2021 universeorange.com