czproject / innudb
该软件包最新版本(v0.9.0)没有提供许可信息。
基于数组的“数据库”操作的实验性库。
v0.9.0
2013-08-18 12:17 UTC
Requires
- nette/nette: 2.0.10
Requires (Dev)
- nette/tester: dev-master
This package is auto-updated.
Last update: 2024-09-14 08:01:27 UTC
README
用于基于数组的“数据库”操作的实验性 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 // ));
支持的数据文件:PHP 文件,NEON,JSON,INI
PHP 文件
<?php return array( 'persons' => 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 文件
persons:
harry-potter:
name: Harry Potter
story: Harry Potter
age: 20
gandalf:
name: Gandalf The White
story: Lord of the Rings
age: 2000
许可:新 BSD 许可证
作者:Jan Pecha,https://www.janpecha.cz/