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(9mo ago)01.1kMITPHPPHP ^8.3

Since Aug 27Pushed 9mo 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 3w 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

44

—

FairBetter than 90% of packages

Maintenance57

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 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

282d 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

[laravel/framework

The Laravel Framework.

34.8k543.8M20.0k](/packages/laravel-framework)[getgrav/grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS

15.6k86.4k1](/packages/getgrav-grav)[illuminate/contracts

The Illuminate Contracts package.

706130.3M13.3k](/packages/illuminate-contracts)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M158](/packages/algolia-algoliasearch-client-php)[directorytree/ldaprecord

A fully-featured LDAP ORM.

5793.4M17](/packages/directorytree-ldaprecord)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)

PHPackages © 2026

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