dev-master
9999999-dev
The Requires
- rkr/php-mysql-query-builder 0.1.*
- vlucas/phpdotenv ~2.4
- ramsey/uuid ~3.5
- particle/validator ~2.0@dev
The Development Requires
by Boy Hagemann
Wallogit.com
2017 © Pedro Peláez
This is a proof of concept of an immutable data storage system. No data will ever get mutated. Every change for both the data schema and the data itself is versioned., (*1)
This package can be used in any API framework., (*2)
Run vendor/bin/phpunit to run all tests., (*3)
$pdo = new PDO( ... );
$entity = new MysqlEntity($pdo);
$record = new MysqlRecord($pdo);
Create a new entity, (*4)
Insert a record, (*5)
By default, it ships with a Mysql driver.
But you can make your own driver, as long as it follows the interfaces.
The drivers must have a test file that extends the AbstractTest.php., (*6)
The package is divided in two concepts: 1. Entities 2. Records, (*7)
An Entity reflects a table in MySQL.
It holds the structure of the data.
An Entity has many Fields that defines the structure.
This is what happens of something changes in an Entity or a Field:
* If an Entity changes, the version of the Entity increments with 1.
* If a Field changes, the version of the Field and its Entity increments with 1., (*8)
A Record reflects a table row in MySQL.
Each Records has a unique _id and holds the actual data.
A Record has many Values that makes up the data.
This is what happens of something changes in a Record:
* If the changes of the Record differ from the last version, then the version of the Record increments with 1.
* If a provided Value differs from the last version of this Value, the version for this Value increments with 1., (*9)