Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sroehrl/fileaway
PHP easy mock db
https://github.com/sroehrl/fileaway
Last synced: 10 days ago
JSON representation
PHP easy mock db
- Host: GitHub
- URL: https://github.com/sroehrl/fileaway
- Owner: sroehrl
- Created: 2020-07-24T17:23:49.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-07-25T01:48:40.000Z (over 4 years ago)
- Last Synced: 2024-04-18T01:45:06.856Z (7 months ago)
- Language: HTML
- Size: 191 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Maintainability](https://api.codeclimate.com/v1/badges/c4b04100572f806177aa/maintainability)](https://codeclimate.com/github/sroehrl/fileAway/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/c4b04100572f806177aa/test_coverage)](https://codeclimate.com/github/sroehrl/fileAway/test_coverage)
[![Build Status](https://travis-ci.com/sroehrl/fileAway.svg?branch=master)](https://travis-ci.com/sroehrl/fileAway)
# fileAway pseudo databaseTest, 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
```PHP
$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 . "
";
}// find one
echo $db->findOne(['title' => 'demo post'])->content;```
## Collaboration
Feel free to add issues, pull-requests & suggestions