PHP Classes

PHP JSON File Database: Create and manipulate databases using JSON files

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 70%Total: 212 All time: 8,347 This week: 65Up
Version License PHP version Categories
file-database 1.0.3GNU General Publi...5.4PHP 5, Databases, Files and Folders
Description 

Author

This class can create and manipulate databases using JSON files.

It can create database table and store them in files in a give database directory with data serialized in the JSON format. The class can also perform other operations like:

- Drop databases or tables
- Insert, update and delete table records
- Retrieve table records that match certain criterion

Picture of Mihajlo Siljanoski
  Performance   Level  
Innovation award
Innovation award
Nominee: 1x

 

Example

<?php

//Example of use

require_once 'lib/filedb.php';

$db=new filedb('testdatabase');


//if you like to drop database and all tables
//$db->drop_database();

//if you like to drop user table
$db->drop_table('user');


//if you like to create user table
$db->create_table('user');



//if you like to add record in user table if table user doesn't exist automaticaly will be created
$db->insert('user',['name'=>'Mihajlo','surname'=>'Siljanoski','web'=>'http://1mk.org/','username'=>'admin','password'=>md5('admin')]);



//to update record in user table
$db->update(
       
'user',
        [
'surname'=>'Siljanoski updated','web'=>false,'address'=>'Test address'],//address will be added and web will be deleted
       
['_id'=>1,'name%'=>'mihajlo'] // where ID =1 AND name LIKE '%mihajlo%'
);


//to delete record with _id=5
$db->delete(
       
'user',
        [
'_id'=>5]
);


//fetch records from database something like SELECT * FROM users WHERE name='Mihajlo' AND surname LIKE '%ski%'
$results=$db->get('user',
        [
           
'name'=>'Mihajlo',
           
'surname%'=>'ski',
        ]
    );
print_r($results);


Details

file-database

Non-sql database on filesystem

Non-sql database based on file system. With this class you can add storage on filesystem and access data on simplest way ever.


  Files folder image Files (6)  
File Role Description
Files folder imagelib (1 file)
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file example2.php Example relations example
Accessible without login Plain text file example3.php Example Example file
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:212
This week:0
All time:8,347
This week:65Up
 User Ratings  
 
 All time
Utility:91%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:75%StarStarStarStar
Examples:83%StarStarStarStarStar
Tests:-
Videos:-
Overall:70%StarStarStarStar
Rank:244