https://github.com/czproject/innudb
[PHP] Experimental library for manipulation with array-based "database".
https://github.com/czproject/innudb
Last synced: over 1 year ago
JSON representation
[PHP] Experimental library for manipulation with array-based "database".
- Host: GitHub
- URL: https://github.com/czproject/innudb
- Owner: czproject
- License: other
- Created: 2013-06-22T21:03:36.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2017-12-27T14:20:15.000Z (over 8 years ago)
- Last Synced: 2025-02-12T06:53:56.228Z (over 1 year ago)
- Language: PHP
- Size: 20.5 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
InnuDb
======
Experimental PHP library for manipulation with array-based "database".
``` php
$pathToFile = __DIR__ . '/data.php'; // see file content below
$loader = new Cz\InnuDb\Loader;
$innudb = new Cz\InnuDb\InnuDb($loader, $pathToFile);
$persons = $innudb->createCollection('persons');
foreach($persons as $id => $item)
{
var_dump($item);
}
// $persons->getCount();
//
// $persons->limit(limit);
// $persons->limit(limit, offset);
//
// $persons->sort('column'); // ASC is default
// $persons->sort('column', 'ASC'); // or order('column')
// $persons->sort('column', 'DESC'); // ASC is default
// $persons->sort(array(
// 'column' => 'ASC', // or 'DESC'
// ));
// $persons->sort('name')->sort('age', 'DESC'); // fluent interface
//
// $persons->where('column', 'value'); // column = value
// $persons->where('column >', 'value'); // column > value
// $persons->where('column <=', 'value'); // column <= value
// $persons->where('column', 'value')->where('column2 >', 'value2'); // fluent interface: column = value AND column2 > value2
// $persons->where(array(
// 'column' => 'value', // column = value
// 'column2 <=' => 'value2', // AND column2 <= value2
// ));
```
Supported data files: PHP file, [NEON](http://ne-on.org), JSON, INI
PHP file
--------
``` php
array( // 'persons' subset
'harry-potter' => array(
'name' => 'Harry Potter',
'story' => 'Harry Potter',
'age' => 20,
),
'gandalf' => array(
'name' => 'Gandalf The White',
'story' => 'Lord of the Rings',
'age' => 2000,
),
),
);
```
NEON file
---------
```
persons:
harry-potter:
name: Harry Potter
story: Harry Potter
age: 20
gandalf:
name: Gandalf The White
story: Lord of the Rings
age: 2000
```
-----------------------
License: [New BSD License](license.md)
Author: Jan Pecha, https://www.janpecha.cz/