Function file_base
https://github.com/filebase/Filebase
A Simple but Powerful Flat File Database Storage. No need for MySQL or an expensive SQL server
, in fact,you just need your current site or application setup. All database entries are stored in files (formatted the way you like).
You can even modify the raw data within the files themselves without ever needing to use the API. And even better you can put all your files in version control and pass them to your team without having out-of-sync SQL databases.
Doesn't that sound awesome?
With Filebase
, you are in complete control. Design your data structure the way you want. Use arrays and objects like you know how in PHP. Update and share your data with others and teams using version control. Just remember,upgrading your web/apache server is a lot less than your database server.
Works with PHP 5.6 and PHP 7+
Features Filebase is simple by design
,but has enough features for the more advanced.
Key/Value and Array-based Data Storing Querying data Custom filters Caching (queries) Database Backups Formatting (encode/decode) Validation (on save) CRUD (method APIs) File locking (on save) Intuitive Method Naming
// setting the access and configration to your database $database = new \Filebase\Database([ 'dir' => 'path/to/database/dir' ]);
// in this example
,you would search an exact user name // it would technically be stored as user_name.json in the directories // if user_name.json doesn't exists get will return new empty Document $item = $database->get('kingslayer');
// display property values echo $item->first_name; echo $item->last_name; echo $item->email;
// change existing or add new properties $item->email = 'example@example.com'; $item->tags = ['php'
, 'developer','html5'];
// need to save? thats easy! $item->save();
// check if a record exists and do something if it does or does not if ($database->has('kingslayer')) { // do some action }
// Need to find all the users that have a tag for "php" ? $users = $db->query()->where('tags'
, 'IN','php')->results();
// Need to search for all the users who use @yahoo.com email addresses? $users = $db->query()->where('email'
, 'LIKE', '@yahoo.com')->results();Located at config/file.php
string |
$tableName |
Filebase\Document
|
\Filebase\Document |