PHP Classes

Div PHP Nodes: Manage database of objects stored in record files

Recommend this page to a friend!
  Info   View files Example   View files View files (15)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 60%Total: 506 All time: 5,779 This week: 148Up
Version License PHP version Categories
div-nodes 1.7GNU General Publi...5.0PHP 5, Databases, Files and Folders
Collaborate with this project 

Author

divengine.div-nodes - github.com

Description

This class can manage database of mixed values (atomic values, arrays, objects) named "nodes", stored in record files.

It can create records that are stored in node files of a given schema directory.

Each node is serialized before storing the values in a file. Node files have a named defined by a identifier. Nodes may also reference other nodes in different schema directories.

The class may also search for nodes that match conditions, check if a node exists, update, delete and rename nodes already stored in record files, lock node files to prevent changes, get, add and remove node references, check if a schema directory exists, create, rename and delete schema directories.

Innovation Award
PHP Programming Innovation award nominee
January 2015
Number 6
Many PHP applications use relational databases to store and retrieve application information by connecting to SQL database servers.

Alternatively applications can also store information in file base databases that do not require the use of SQL, the so called noSQL databases.

This class provides a pure PHP implementation of a noSQL database that stores and retrieves information in files.

It provideds features to avoid problems caused by concurrent accesses such as the use of proper file locking, among other the non-trivial file database access features.

Manuel Lemos
Picture of Rafa Rodriguez
  Performance   Level  
Name: Rafa Rodriguez <contact>
Classes: 5 packages by
Country: Suriname Suriname
Age: 37
All time rank: 17841 in Suriname Suriname
Week rank: 438 Up1 in Suriname Suriname Equal
Innovation award
Innovation award
Nominee: 2x

Example

<?php

/**
 * Div PHP Nodes
 *
 * Example
 *
 * @author Rafa Rodriguez [@rafageist] <rafageist@hotmail.com>
 */

include "../divNodes.php";

// Adding a schema on the fly if not exists
$db = new divNodes("database/contacts");

// Deleting all nodes in schema database/contacts
$db->delNodes();

// Add node into schema database/contacts
$id = $db->addNode([
   
"name" => "Peter Nash",
   
"age" => 25,
   
"city" => 'NY'
]);

// Change data of node
$db->setNode($id, [
   
"email" => "peter@email.com",
   
"phone" => "+1222553335"
]);

$id = $db->addNode(array(
   
"name" => "John Nash",
   
"age" => 15,
   
"city" => 'FL'
));

// Retrieve a node from schema database/contacts
$contact = $db->getNode($id);

// Drop index
$db->delSchema('database/contacts/.index');

// Remove node in current schema
$db->delNode($id);


Details

Div PHP Nodes 1.3

No-SQL Database System for PHP

Library for storage relational and serialized data using only PHP. The database can be divided into schemas. The objects (nodes) can be indexed for full text search and fast lookup.

Introduction

Many PHP applications use relational databases to store and retrieve application information by connecting to SQL database servers.

Alternatively applications can also store information in file base databases that do not require the use of SQL, the so called noSQL databases.

This class provides a pure PHP implementation of a noSQL database that stores and retrieves information in files.

It provides features to avoid problems caused by concurrent accesses such as the use of proper file locking, among other the non-trivial file database access features.

Description

This class can manage database of mixed values (atomic values, arrays, objects) named "nodes", stored in record files. It can create records that are stored in node files of a given schema directory.

Each node are serialized before storing the values in a file. Node files have a named defined by a identifier. Nodes may also reference other nodes in different schema directories.

The class may also: - search for nodes that match conditions, - check if a node exists, - update, delete and rename nodes already stored in record files, - lock node files to prevent changes - get, add and remove node references, - check if a schema directory exists, - create, rename and delete schema directories. - iterate each node with closure function - index the node's content for full text search - store statistics, and update it dynamically

Basic usage

<?php

include 'divNodes.php';
$db = new divNodes("database/contacts");

$id = $db->addNode(array(
    "name" => "Peter",
    "age" => 25
));

$db->setNode($id, array(
    "email" => "peter@email.com",
    "phone" => "+1222553335"
));

$contact = $db->getNode($id);

$db->delNode($id);

For more details you can see the examples.


  Files folder image Files  
File Role Description
Files folder imageexamples (9 files)
Accessible without login Plain text file .gitignore Data Auxiliary data
Accessible without login Plain text file CHANGELOG.txt Data first commit
Accessible without login Plain text file composer.json Data first commit
Plain text file divNodes.php Class Class source
Accessible without login Plain text file LICENSE Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  examples  
File Role Description
  Accessible without login Plain text file basic.php Example first commit
  Accessible without login Plain text file create_index.php Example Example script
  Accessible without login Plain text file create_order.php Example Example script
  Accessible without login Plain text file create_property_index.php Example Example script
  Accessible without login Plain text file entities.php Example first commit
  Accessible without login Plain text file foreach.php Example Example script
  Accessible without login Plain text file references.php Example first commit
  Accessible without login Plain text file rename.php Example Example script
  Accessible without login Plain text file stats.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:506
This week:0
All time:5,779
This week:148Up
User Ratings User Comments (1)
 All time
Utility:87%StarStarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:-
Examples:87%StarStarStarStarStar
Tests:-
Videos:-
Overall:60%StarStarStarStar
Rank:1312
 
nice
7 years ago (muabshir)
80%StarStarStarStarStar