Persistence simplified
Latest commit 60517be Jan 30, 2015 @henriquemoody henriquemoody Merge pull request #2 from henriquemoody/readme
Fix wrong link to Packagist on ""
Failed to load latest commit information.
library/Respect/Data Use PSR-2 standard Jan 9, 2015
.gitignore Remove Makefile from repository Jan 9, 2015
LICENSE Update year in "LICENSE" file Jan 9, 2015
composer.json Update "composer.json" file Jan 9, 2015
phpunit.xml.dist Update PHPUnit settings Jan 9, 2015


Build Status Latest Version Total Downloads License

Respect\Data allows you to use multiple, cooperative database mapping with a single solid API. You can even mix out MySQL and MongoDB databases in a single model.

This project is a work in progress


The package is available on Packagist. You can install it using Composer.

composer require respect/data

PSR-0 and PSR-2 compatible.


The main component for Respect\Data are Collections. They define how data is grouped in your application.

In the example below, we're declaring two collections for dealing with a news portal:

$articles = Collection::article();
$authors = Collection::article()->author();


Currently, Respect\Data has two planned backend implementations: Respect\Relational for relational databases like MySQL and SQLite and Respect\Structural for MongoDB databases. These are different mappers that use the Respect\Data model.

Below is a sample of how to retrieve all authors from the author 5:

  • On the Relational backend, Respect would automatically build a query similar to SELECT * FROM article INNER JOIN author ON article.author_id = WHERE = 5.
  • On the Structural backend for MongoDB, the generated internal query would be something like db.article.find({"":5}, {"author":1});.


Besides fetching data from databases, Respect\Data is expected to deal with several other scenarios:

  • Persisting data into collections
  • Using backend-native extra commands in queries
  • Declaring shortcuts for large collection declarations
  • Handling composite mapper backends


See LICENSE file.