Fork me on GitHub

Orm

composer require nextras/orm

Stack

Orm is clearly designed to abstract entities from database implementation, therefore it separates your model into three basic layers:

  • Entities

    Entities are data crates, hold your data, validate values and provide some API for entities connection, relationships and traversal.

  • Repositories

    Repositories form a layer which takes care about your entities. Repository requires a mapper as a dependency. Repository does not know anything about your storage (e.g. database), only manages entities and provides API for entities getting, filtering, storing and removing.

  • Mappers

    Mappers are the backend of the whole Orm. Mapper provides interaction with database layer. Orm comes with mapper layer which uses Nextras\Dbal library.

Everything is connected in central Model, which manages all repositories.