2017 © Pedro Peláez
 

library datastore

Interacting with File Based Data

image

christopher-paul-shaw/datastore

Interacting with File Based Data

  • Monday, July 9, 2018
  • by chris-shaw
  • Repository
  • 0 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Summary

This is a class which uses the directory and file structure of a filesystem to store and manipulate information. It does so using unique indentifiers for folder names and .dat files to hold the content of fields., (*1)

Why would you use DataStore

DataStore in its current version works only with the filesystem, which although not scalable for larger datasets, can be of use for simpler systems., (*2)

  • Low overhead compared to a database
  • Capable of Creating, Reading, Updating, Deleting and Searching through data
  • Can be easily extended to add additional functionality
  • Simple to Backup and Restore Data

Some Example Uses

  • User Login System
  • Blog / Guesbook
  • System Logging

History Timeline for DataStore

DataStore is the evolution of a class called Entity from (https://webpi.chris-shaw.com) Entity was a raw class to standardise how the WebPi software would interact with data stored within the filesystem, (*3)

  • Started Life as Entity.php in WebPi ()
  • Became a general way for WebPi to access data and becoming basis for an authentication class.
  • Was moved to its own repository with unit tests to be shared between progects
  • Renamed to DataStore and Added to packagest for composer install

Usage

Creating

$payload = [
       'id_entity' => 'testId',
       'test' => 'case'
];

$dataStore = new DataStore('exampleID');
$dataStore>create($payload);

Read

$dataStore = new DataStore('exampleID');
$dataStore>getValue('fieldname');

Updating

$dataStore = new DataStore('exampleID');
$dataStore>getValue('field', 'value');

Deleting

$dataStore = new DataStore('exampleID');
$dataStore>delete();

Searching

$filters = [
    ['field','=','value'],
    ['field','>','value']
];

$search = new DataStore();
$results = $search->search();

How to Install

1. Composer

The preferred method is using composer (https://getcomposer.org/) and can be insalled using the following command, (*4)

composer require christopher-paul-shaw/datastore 

2. Cloning

You can also clone the repository from github, (*5)

git clone git@github.com:christopher-paul-shaw/DataStore.git

Running Tests

vendor/bin/phpunit test

The Versions

09/07 2018

dev-master

9999999-dev

Interacting with File Based Data

  Sources   Download

The Requires

 

The Development Requires

by Chris Shaw

09/07 2018

dev-search

dev-search

Interacting with File Based Data

  Sources   Download

The Requires

 

The Development Requires

by Chris Shaw

05/07 2018

1.0.1

1.0.1.0

Interacting with File Based Data

  Sources   Download

The Requires

 

The Development Requires

by Chris Shaw

01/07 2018

1.0

1.0.0.0

Flat File Data Management

  Sources   Download

The Requires

 

The Development Requires

by Chris Shaw