Powerfull and fast PDO-based data mapper

Maintainers

👁 adrianmiu

Package info

github.com/siriusphp/Orm

Issues

pkg:composer/siriusphp/orm

Statistics

Installs: 46

Dependents: 0

Suggesters: 0

Stars: 13

2.0.0 2020-12-12 10:41 UTC

Suggests

Provides

None

Conflicts

None

Replaces

None

MIT 65b30f9c8532aafdec4107266456c52fb2e47891

  • Adrian Miu <adrian.woop@adrianmiu.ro>

ormsqldatapdodatamappermappingModellingEntity Frameworknot-activerecord

This package is auto-updated.

Last update: 2026-06-14 04:24:13 UTC


README

👁 Source Code
👁 Latest Version
👁 Software License
👁 Build Status
👁 Coverage Status
👁 Quality Score

Sirius ORM is a fast and lightweight yet flexible data mapper solution developed with DX in mind. It offers:

  1. Mapping rows to your own entities
  2. Relations and relation aggregates (COUNT/AVERAGE)
  3. Eager-loading & lazy-loading (without increasing the number of queries)
  4. Queries that let you JOIN with relations (not tables)
  5. Deep persistence
  6. Dynamically defined mappers
  7. Speed & low memory usage (no Entity Manager)
  8. 90+% code coverage

Installation

composer require siriusphp/orm

Initialization

use Sirius\Orm\Orm;
use Sirius\Orm\ConnectionLocator;
$connectionLocator = ConnectionLocator::new(
 'mysql:host=localhost;dbname=testdb',
 'username',
 'password'
);
$orm = new Orm($connectionLocator);

Configuration

AKA, registering mappers and relations

$orm->register('pages', MapperConfig::fromArray([
 /**
 * here goes the configuration 
 */
]));

// continue with the rest of mappers

Usage

// find by ID
$page = $orm->find('pages', 1);
// or via the mapper
$page = $orm->get('pages')->find(1);

// query
$pages = $orm->select('pages')
 ->where('status', 'published')
 ->orderBy('date desc')
 ->limit(10)
 ->get();

// manipulate
$page->title = 'Best ORM evah!';
$page->featured_image->path = 'orm_schema.png';

// persist
$orm->save($page);
// or via the mapper
$orm->get('pages')->save($page);

Links