PHPackages                             delphi/php-orm - 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. delphi/php-orm

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

delphi/php-orm
==============

ORM for interacting with Graph DB

03PHP

Since Aug 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/delphi-code/php-orm)[ Packagist](https://packagist.org/packages/delphi/php-orm)[ RSS](/packages/delphi-php-orm/feed)WikiDiscussions main Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

ORM
===

[](#orm)

Basic structure to handle persisting objects in a GraphDB

⚠ Does not handle any sort of data extraction yet. This is effectively write-only for now.

Usage
=====

[](#usage)

Setup
-----

[](#setup)

```
// Create a new entity manager, but first we need...

// ... a DB client object (See delphi/client-laudis for an *actual* implementation) ...
$client = new class implements \delphi\ORM\Client\ClientInterface {};

// ... a QueryBuilder (with its own dependencies) ...
$annotationReader = new \Doctrine\Common\Annotations\AnnotationReader();
$annotationDriver = new \delphi\ORM\Driver\AnnotationDriver($annotationReader);
$queryBuilder = new \delphi\ORM\QueryBuilder($annotationDriver);

$em = new \delphi\ORM\EntityManager($client, $queryBuilder);
```

Configuration
-------------

[](#configuration)

```
namespace App;
use delphi\ORM\Annotation as OGM;

/**
 * @OGM\Entity(label="Foo")
 */
class Foo {
    /**
     * @OGM\Property(name="name")
     */
    public string $name = '';

    /**
     * @OGM\Relationship(type="CHILD_OF", targetEntity="\App\Bar")
     */
    public Bar $parentBar;
}
```

- Set the object as an `Entity(label="LabelVal")`
    - `label` is the string to be used as the label inside of the GraphDB
- Set individual properties as a `Property(name="propertyName", unique=true)`
    - `name` is the name to be given to the property
    - `unique` is the optional flag to say a particular property is unique amongst all entities with this label. Defaults to `false`.
- Set relationships as `Relationship(type="RELATIONSHIP_TYPE", targetEntity="\App\Bar", multiple=false)`
    - `type` is the name given to the edge (relationship) inside of the GraphDB
    - `targetEntity` is the PHP class name odf the entity on the other end of the relationship
    - `multiple` is the optional flag to say whether a relationship is 1-to-1 or 1-to-many

Otherwise, entities are plain-old-PHP-objects, and you can do with them what you want.

If you want to have the properties *not* be public, you can add getter methods for individual properties. See `\delphi\ORM\Util\PropertyGetter`.

Execution
---------

[](#execution)

```
// Create a new entity...
$entity = new Foo();
$entity->name = 'Nombre';
$entity->parentBar = new Bar();

// ... and set it to be persisted
$em->persist($entity);

// There won't be any DB interactions performed until...

// ...actually save the entity off to the DB
$em->flush();
```

This will result in 2 nodes with 1 edge between them.

```
+---------------+
|      Foo      |
| name="Nombre" |
+---------------+
  |
  | CHILD_OF
  v
+---------------+
|      Bar      |
+---------------+

```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/901145f58f6157a06fc2d34aebd90a994f6f7b86ddf5119cabe9b0e840b68d63?d=identicon)[xiian](/maintainers/xiian)

---

Top Contributors

[![xiian](https://avatars.githubusercontent.com/u/133872?v=4)](https://github.com/xiian "xiian (29 commits)")

### Embed Badge

![Health badge](/badges/delphi-php-orm/health.svg)

```
[![Health](https://phpackages.com/badges/delphi-php-orm/health.svg)](https://phpackages.com/packages/delphi-php-orm)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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