Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/annoraaq/parrotdb
ParrotDb is an open source object database written in PHP. It is not intended for use in production and rather a proof of concept.
https://github.com/annoraaq/parrotdb
Last synced: 1 day ago
JSON representation
ParrotDb is an open source object database written in PHP. It is not intended for use in production and rather a proof of concept.
- Host: GitHub
- URL: https://github.com/annoraaq/parrotdb
- Owner: Annoraaq
- Created: 2015-08-27T18:44:59.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-03-26T00:48:24.000Z (over 2 years ago)
- Last Synced: 2024-11-04T18:24:19.835Z (about 2 months ago)
- Language: PHP
- Homepage:
- Size: 747 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# ParrotDb
ParrotDb is an open source object database written in PHP.Please note this is a fun project and not intended for use in production.
It is rather a proof of concept. However, feel free to check out the [benchmark section](https://github.com/Annoraaq/ParrotDb/wiki/Benchmarks)
of the [wiki](https://github.com/Annoraaq/ParrotDb/wiki) to get a first impression of performance.
ParrotDb comes with an own [query language](https://github.com/Annoraaq/ParrotDb/wiki/Language-of-the-Birds) as well as an own [text file format](https://github.com/Annoraaq/ParrotDb/wiki/Feather-file-format).# Installation
```git clone https://github.com/Annoraaq/ParrotDb.git``````composer install```
# Run tests
```vendor/bin/phpunit```# Basic usage
Let's say we have an example class:
```
class Bird
{
public $id;
public $name;
}
```Now we need to create a session, a parser and a persistence manager:
```
$session = \ParrotDb\Core\PSessionFactory::createSession(
"Testfile",
\ParrotDb\Core\PSession::DB_XML
);$parser = new \ParrotDb\Query\LotB\Parser\Parser($session->getDatabase());
$pm = $session->createPersistenceManager();
```## Insert
```
$bird = new Bird();
$bird->id = 42;
$bird->name = "Pelecanidae";$pm->persist($bird);
$pm->commit();
```## Select
```
$constraint = $parser->parse('get Bird id = 42');
$resultSet = $pm->query($constraint);
$fetchedBird = $resultSet->first();
```
## Update
```
$constraint = $parser->parse('get Bird id = 42');
$resultSet = $pm->query($constraint);
$fetchedBird = $resultSet->first();
$fetchedBird->name = "Pidgeon";
$pm->commit();
```## Delete
```
$constraint = $parser->parse('get Bird id = 42');
$pm->delete($constraint);
```