PHPackages                             cycle/orm-promise-mapper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. cycle/orm-promise-mapper

ActiveLibrary[Database &amp; ORM](/categories/database)

cycle/orm-promise-mapper
========================

Promise mapper for Cycle ORM

1.0.2(1y ago)21.4k31MITPHPPHP &gt;=8.0CI passing

Since Dec 22Pushed 1y ago3 watchersCompare

[ Source](https://github.com/cycle/orm-promise-mapper)[ Packagist](https://packagist.org/packages/cycle/orm-promise-mapper)[ RSS](/packages/cycle-orm-promise-mapper/feed)WikiDiscussions 1.x Synced yesterday

READMEChangelog (3)Dependencies (8)Versions (4)Used By (1)

Cycle ORM PromiseMapper
=======================

[](#cycle-orm-promisemapper)

[![Latest Stable Version](https://camo.githubusercontent.com/5798cd5c47c733d72a7a92390d43ef3d40bd9a069cac20ae05c1fd3936e9d129/68747470733a2f2f706f7365722e707567782e6f72672f6379636c652f6f726d2d70726f6d6973652d6d61707065722f76657273696f6e)](https://packagist.org/packages/cycle/orm-promise-mapper)[![Build Status](https://github.com/cycle/orm-promise-mapper/workflows/build/badge.svg)](https://github.com/cycle/orm-promise-mapper/actions)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/bf4f590f5a1cf6551d3965804436f60e2e8599af9dbfae827defda1a794b19d6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6379636c652f6f726d2d70726f6d6973652d6d61707065722f6261646765732f7175616c6974792d73636f72652e706e673f623d312e78)](https://scrutinizer-ci.com/g/cycle/orm-promise-mapper/?branch=1.x)[![Codecov](https://camo.githubusercontent.com/27107ea5ce8de00b14051aa654f83793d3de83a663e1ec6dddbc173df634e791/68747470733a2f2f636f6465636f762e696f2f67682f6379636c652f6f726d2d70726f6d6973652d6d61707065722f67726170682f62616467652e737667)](https://codecov.io/gh/cycle/orm-promise-mapper)[![](https://camo.githubusercontent.com/4442b73a11753b80fdd7b442ddbfaf8383902c8b9ffa66ed1718e8c62e102f2e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646973636f72642d636861742d6d6167656e74612e737667)](https://discord.gg/TFeEmCs)

Cycle ORM provides the ability to carry data over the specific class instances by using `cycle/orm-promise-mapper`package with `\Cycle\ORM\Reference\Promise` objects for relations with lazy loading.

Installation
------------

[](#installation)

The preferred way to install this package is through [Composer](https://getcomposer.org/download/):

```
composer require cycle/orm-promise-mapper
```

Define the Entity
-----------------

[](#define-the-entity)

```
use Cycle\Annotated\Annotation\Entity;
use Cycle\Annotated\Annotation\Column;
use Cycle\Annotated\Annotation\Relation\BelongsTo;
use Cycle\Annotated\Annotation\Relation\HasMany;
use Cycle\ORM\Reference\ReferenceInterface;

#[Entity]
class User
{
    #[Column(type: 'primary')]
    public int $id;

    #[HasMany(target: Post::class, load: 'eager')]
    public array $posts;

    #[HasMany(target: Tag::class, load: 'lazy')]
    public ReferenceInterface|array $tags;
}

#[Entity]
class Post
{
    // ...

    #[BelongsTo(target: User::class, load: 'lazy')]
    public ReferenceInterface|User $user;

    #[BelongsTo(target: Tag::class, load: 'eager')]
    public Tag $tag;
}
```

Fetching entity data
--------------------

[](#fetching-entity-data)

```
$user = $orm->getRepository('user')->findByPK(1);

// $user->posts contains an array because of eager loading
foreach ($user->posts as $post) {
    // ...
}

// $user->tags contains Cycle\ORM\Reference\Promise object because of lazy loading
$tags = $user->tags->fetch();
foreach ($tags as $post) {
    // ...
}

$post = $orm->getRepository('post')->findByPK(1);

// $post->user contains Cycle\ORM\Reference\Promise object because of lazy loading
$userId = $post->user->fetch()->id;

// $post->tag contains Tag object because of eager loading
$tagName = $post->tag->name;
```

License:
--------

[](#license)

The MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maintained by [Spiral Scout](https://spiralscout.com).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance43

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~408 days

Total

4

Last Release

428d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/796136?v=4)[Anton Tsitou](/maintainers/wolfy-j)[@wolfy-j](https://github.com/wolfy-j)

---

Top Contributors

[![roxblnfk](https://avatars.githubusercontent.com/u/4152481?v=4)](https://github.com/roxblnfk "roxblnfk (13 commits)")[![msmakouz](https://avatars.githubusercontent.com/u/67324318?v=4)](https://github.com/msmakouz "msmakouz (5 commits)")[![butschster](https://avatars.githubusercontent.com/u/773481?v=4)](https://github.com/butschster "butschster (2 commits)")[![vjik](https://avatars.githubusercontent.com/u/525501?v=4)](https://github.com/vjik "vjik (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/cycle-orm-promise-mapper/health.svg)

```
[![Health](https://phpackages.com/badges/cycle-orm-promise-mapper/health.svg)](https://phpackages.com/packages/cycle-orm-promise-mapper)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k300.5M7.5k](/packages/doctrine-orm)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M306](/packages/laravel-horizon)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[cycle/orm

PHP DataMapper ORM and Data Modelling Engine

1.3k918.0k77](/packages/cycle-orm)[doctrine/mongodb-odm

PHP Doctrine MongoDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to MongoDB.

1.1k24.5M359](/packages/doctrine-mongodb-odm)[cycle/database

DBAL, schema introspection, migration and pagination

71777.8k53](/packages/cycle-database)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
