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: about 2 months 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-11-10T02:14:43.355Z (3 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
[](https://codeclimate.com/github/sroehrl/fileAway/maintainability)
[](https://codeclimate.com/github/sroehrl/fileAway/test_coverage)
[](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