Skip to content

a PHP Object Store flat-file database inspired by PHP MongoDB

Notifications You must be signed in to change notification settings

yinsee/phpObjectStore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

ObjectStore is a flat file value-key pair database for PHP, inspired by MongoDB PHP class.
It is suitable to be used in simple CMS websites that does not require full-featured database.

Copyriht (C) 2011 "Daddycat" Tan Yin See -- [email protected] 

Latest Source: http://github.com/yinsee/phpObjectStore

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

--------------------------------------------------------------------------------------------

1) How to use
<?
require("class.ObjectStore.php");
// $options is optional parameter
$options = array('gzip'=>9, 'autosave'=>true, 'dir'=>'/var/lib/phpobjstore/');
$db = new ObjectStore('name', $options);
...
...
?>

simple one db scenario
----------------------
Add / Insert:
$id = $db->insert(array $newdata);

Update:
$db->update($id, array $newdata);

Set / Replace:
$db->set($id, array $newdata);

Find:
$result = $db->find($id) or (array $search_keys);
* $search_keys supports PHP preg_search, eg: array($brand => new Regexp('/apple|dell/i'));

Delete:
$db->delete($id);

multiple tables scenario
------------------------
$id = $db->table->insert(array $newdata);
$db->table->update($id, array $newdata); 
$db->table->set($id, array $newdata);
$result = $db->table->find($id) or (array $search_keys);
$db->table->delete($id);

About

a PHP Object Store flat-file database inspired by PHP MongoDB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages