Skip to content
This repository was archived by the owner on Apr 27, 2022. It is now read-only.

bendahrooge/PHP-Simple-Database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

PHP-Simple-Database

A simple flat-file key/value storage class for PHP. Great for small databases or servers where SQL can't be used. Only 150 lines of code :)

This is not a replacement for SQL or other databases, and it should only be used in smaller applications where a conventional database isn't possbile. It is very inefficient and slow for PHP to keep pulling and overwriting an entire JSON file.

Example

<?php
require_once 'database.class.php';

$fruit = new Database();

//Writes Data into file
$fruit->set('types', array('apples', 'bananas', 'clementines'));
  //returns TRUE or Error

//Tells if a key is stored in the file
$fruit->search('types');
  //returns TRUE
  
$fruit->search('prices');
  //returns FALSE
  
//Returns the value of a key
$fruit->get('types');
  //returns that.object

//Deletes a value in file
$fruit->del('types');
  //returns TRUE

About

Flat-file key/value storage class for PHP in 150 lines

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages