neoan3-apps/file-away

dead-simple file "database" for testing, mocking, click-dummies & POCs

Installs: 14

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:HTML

v1.0.0 2020-07-25 01:13 UTC

This package is auto-updated.

Last update: 2024-10-25 11:37:49 UTC


README

Maintainability Test Coverage Build Status

fileAway pseudo database

Test, Mock, Store, Show, Develop faster examples, mock-APIs and apps.

This "database" solution is meant for rapid development and not intended to be used in production. If used in production, please consider the following:

  • is the location of the json-file secure? (e.g. protect via .htaccess in apache)
  • will I require scalability or handling of bigger datasets? (If so: this is not your production solution!)

What is it used for?

Ever needed to quickly scaffold an API? Ever needed some test data for your unit tests? Ever wanted to create a quick proof of concept? This "database" is for you.

Installation

composer require neoan3-apps/file-away

Usage

$db = new \Neoan3\Apps\FileAway('storage.json');

// add entry to new or existing entity
$db->setEntity('articles') // set current entity
   ->add(['title'=>'demo post', 'content' => 'such text']) // add entry to entity
   ->save() // write to db

// list all entries (NOTE: we assume that the entity is still set)
foreach($db->find() as $post) {
    echo $post->title . "<br>";
}

// find one
echo $db->findOne(['title' => 'demo post'])->content;

Collaboration

Feel free to add issues, pull-requests & suggestions