Recommend this page to a friend!
  Classes of Maik Greubel  >  Caribu ORM  >  >  Download  
Role: Documentation
Content type: text/markdown
Description: Readme
Class: Caribu ORM
Map objects to databases records using annotations
Author: By
Last change: Update

Remove coveralls, use scrutinizer badge instead
Date: 5 years ago
Size: 3,054 bytes


Class file image Download

Build Status Code Coverage Scrutinizer Code Quality Dependency Status Codacy Badge


An annotation-based PHP Object Relational Mapper

This project aims to be an object relational mapper easy to use. The main target is to support developers writing only simple attribute containing classes and store it as entities into a database.

It has support for annotations so it is very flexible.

Here is a very basic example about the usage (for sqlite):

    CREATE TABLE super_duper_content (id INTEGER PRIMARY KEY, content TEXT);

     * @table super_duper_content
    class SuperDuperEntity extends AbstractModel
       * @column id
      private $sid;
      private $content;
      public function setSid($sid)
        $this->sid = $sid;
      public function getSid()
        return $this->sid;
      public function setContent($content)
        $this->content = $content;
      public function getContent()
        return $this->content;

    use \Nkey\Caribu\Orm\Orm;
    /First configure the ORM/
      'type' => 'sqlite',
      'file' => ':memory:'
    // Create sqlite database table for memory storage
    // Orm::getInstance()->getConnection()->exec("CREATE TABLE super_duper_content (id INTEGER PRIMARY KEY, content TEXT)");
    /Now create a new entity and persist it to database/
    $entity = new SuperDuperEntity();
    $entity->setContent("Mega important content");

    /First read the entity from database/
    $entity = SuperDuperEntity::find(array('content' => "Mega important content"));
    /Display the content/
    echo $entity->getContent();

No need to write infrastructure and boilerblate code by yourself. Let the Orm do the hard work for you.

Caribu provides a convention-over-configuration behaviour by supporting annotations.

See the Wiki for more information about the capabilities and usage.

For more information send a message to info at phpclasses dot org.