PHPackages                             linkorb/sage - 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. linkorb/sage

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

linkorb/sage
============

Sage: active record interface to a set distributed data repositories supporting virtual fields

v3.0.0(7mo ago)01.1kMITPHPPHP ^8.3

Since Aug 27Pushed 7mo ago2 watchersCompare

[ Source](https://github.com/linkorb/sage)[ Packagist](https://packagist.org/packages/linkorb/sage)[ Docs](https://github.com/linkorb/sage)[ RSS](/packages/linkorb-sage/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (8)Dependencies (3)Versions (11)Used By (0)

Sage
====

[](#sage)

A Sage instance allows you to

1. Transparently access data stored in Repositories of different types (PDO, Array, Cache, NdJson files, etc) as in-memory arrays
2. Traverse relations (one-to-many, many-to-one) between them
3. Access virtual fields (akin to GraphQL field resolvers) for modifications, calculations and other advanced use-cases

Sage can be thought of as a supersedence of [linkorb/context](https://github.com/linkorb/context).

Usage
-----

[](#usage)

1. Instantiate a new Sage\\Sage instance
2. Instantiate a Repository for each table/collection you'd like to access
3. Attach the Repositories to the Sage instance
4. Add "Virtual Fields" to specify relations between tables or add data modifiers
5. Query tables using common `findAll()` with conditions
6. Access the resulting rows as an array, allowing you to traverse the array as if it is all in-memory (Sage lazy-loads accessed rows behind the scenes).

Definitions
-----------

[](#definitions)

- **Sage**: A collection of repositories and virtual fields
- **Repository**: Analogue to a database table/collection. May be backed by different storage methods (see src/Repository/ for current implementations)
- **Record**: An in-memory Record can be accessed as an array (`$user['name']`) and supports many-to-one and one-to-many relations to other tables though virtual fields

Use-cases
---------

[](#use-cases)

- Rapid application development: You don't need to model objects (with getters/setters/etc) in order to work with them. Just load raw data (from json, yaml, arrays, pdo, etc for example) and you're ready to traverse the repositories and records within it.
- Complex medical record mapping/conversion: Use a "context" (subset of records pertaining to a single medical record or patient) then easily traverse it through it's relations.
- Structured Documentation: Model information according to it's domain, then load it into a Context and use (twig/mustache/handlebars) templates to traverse the information.
- GraphQL datastore: A Sage instance is in essence a Graph. A context can therefor be used to generate a GraphQL server which can be used by other applications to easily query the context in a format of their choosing.
- Natural user interface/email/view generation: Simply define a context into a view, and loop over it with any template language such as twig, handlebars, mustache, etc. No further controller logic required.

License
-------

[](#license)

MIT (see [LICENSE.md](LICENSE.md))

Brought to you by the LinkORB Engineering team
----------------------------------------------

[](#brought-to-you-by-the-linkorb-engineering-team)

[![](https://camo.githubusercontent.com/62fb66b034de7ea7fca9fd9776424b5348daa76ef8622caf92c2f7622003e5ef/687474703a2f2f7777772e6c696e6b6f72622e636f6d2f642f6d6574612f74696572312f696d616765732f6c696e6b6f7262656e67696e656572696e672d6c6f676f2e706e67)](https://camo.githubusercontent.com/62fb66b034de7ea7fca9fd9776424b5348daa76ef8622caf92c2f7622003e5ef/687474703a2f2f7777772e6c696e6b6f72622e636f6d2f642f6d6574612f74696572312f696d616765732f6c696e6b6f7262656e67696e656572696e672d6c6f676f2e706e67)
Check out our other projects at [linkorb.com/engineering](http://www.linkorb.com/engineering).

Btw, we're hiring!

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance62

Regular maintenance activity

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 65.2% 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 ~277 days

Recently: every ~381 days

Total

9

Last Release

236d ago

Major Versions

v1.5.0 → v2.0.02025-04-15

v2.0.1 → v3.0.02025-09-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/1db66b320db18b8036ea68211b7d8a39e7c6da97e6fd29f59a50380ebb69d0bb?d=identicon)[joostfaassen](/maintainers/joostfaassen)

---

Top Contributors

[![joostfaassen](https://avatars.githubusercontent.com/u/411113?v=4)](https://github.com/joostfaassen "joostfaassen (15 commits)")[![CesarScur](https://avatars.githubusercontent.com/u/366290?v=4)](https://github.com/CesarScur "CesarScur (4 commits)")[![mhitza](https://avatars.githubusercontent.com/u/273079?v=4)](https://github.com/mhitza "mhitza (4 commits)")

---

Tags

linkorbsage

### Embed Badge

![Health badge](/badges/linkorb-sage/health.svg)

```
[![Health](https://phpackages.com/badges/linkorb-sage/health.svg)](https://phpackages.com/packages/linkorb-sage)
```

###  Alternatives

[phpfastcache/phpfastcache

PHP Abstract Cache Class - Reduce your database call using cache system. Phpfastcache handles a lot of drivers such as Apc(u), Cassandra, CouchBase, Couchdb, Dynamodb, Firestore, Mongodb, Files, (P)redis, Leveldb, Memcache(d), Ravendb, Ssdb, Sqlite, Wincache, Xcache, Zend Data Cache.

2.4k5.0M130](/packages/phpfastcache-phpfastcache)[directorytree/ldaprecord

A fully-featured LDAP ORM.

5782.9M10](/packages/directorytree-ldaprecord)[kreait/firebase-bundle

Symfony Bundle for the Firebase Admin SDK

1534.7M2](/packages/kreait-firebase-bundle)[topthink/think-orm

the PHP Database&amp;ORM Framework

4542.0M218](/packages/topthink-think-orm)[matthiasmullie/scrapbook

Scrapbook is a PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APCu, SQL and additional capabilities (e.g. transactions, stampede protection) built on top.

3212.5M32](/packages/matthiasmullie-scrapbook)[jackalope/jackalope-doctrine-dbal

Jackalope Transport library for Doctrine DBAL

1503.0M214](/packages/jackalope-jackalope-doctrine-dbal)

PHPackages © 2026

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