Skip to content
Datastore Agnostic Model Layer
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
spec Remove the auto merge feature on data amending. Jun 6, 2019
src Remove the auto merge feature on data amending. Jun 6, 2019
.gitignore
.scrutinizer.yml Changes namespace naming convention and uses `Lead` as vendor namespace. Dec 6, 2015
.travis.yml Fix some prefix collisions when extracting default values. Feb 11, 2019
LICENSE.txt Some refactoring and moves the PDO database related logic to a dedica… Jul 30, 2015
README.md Update README. Dec 25, 2016
composer.json
mkdocs.yml Updates documentation. Jul 30, 2015

README.md

Chaos - Domain Modeling Library

Build Status Build Status Scrutinizer Coverage Status

Chaos is an independent, persistence-agnostic layer responsible for defining entities' business logic and relationships. It allows to describe a Domain Model without any assumption about the persistence layer.

Note: The Chaos syntax is derived from li3. If the syntax is not fully compatible with its predecessor, some effort has been made to keep the same clean and beautiful syntax.

Available datasources libraries:

Chaos dramatically simplify the developpment of a datasources libraries by providing all persistence-agnostic logic like relationships, eager/lazy loading, validations, etc. at the root level. The only requirement is the datasource you envisionned to use need to be able to fetch a record/document thanks to a unique identifier (i.e no composite primary key).

Requirements

  • PHP 5.5+

Main Features

  • Support eager/lazy loading
  • Support custom finders
  • Support nested saving
  • Support nested validations
  • Support external & embedded relationship
  • Support custom types & entities' field casting

Example of syntax:

use My\Project\Model\Images;

// Adding a many-to-many relation
$image = Image::load(123);
$image->tags[] = ['name' => 'Landscape'];
$image->broadcast();

foreach($image->tags as $tag) { // Echoes: 'Montain', 'Black&White', 'Landscape'
    echo $tag->name;
}

Documentation

See the whole documentation here.

Testing

The spec suite can be runned with:

cd chaos
composer install
./bin/kahlan
You can’t perform that action at this time.