PHPackages                             sweiguny/php-persistence-api - 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. sweiguny/php-persistence-api

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

sweiguny/php-persistence-api
============================

Interface for PHP-Applications to access Object-Relational data.

35[3 PRs](https://github.com/sweiguny/PHP-Persistence-API/pulls)PHP

Since Nov 18Pushed 5y ago1 watchersCompare

[ Source](https://github.com/sweiguny/PHP-Persistence-API)[ Packagist](https://packagist.org/packages/sweiguny/php-persistence-api)[ RSS](/packages/sweiguny-php-persistence-api/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

PHP Persistence API
===================

[](#php-persistence-api)

[![Build Status](https://camo.githubusercontent.com/0e6683ac0d7581ee93092b9bad980f09d960f69105250d11362b8f0aeb8494e4/68747470733a2f2f7472617669732d63692e6f72672f7377656967756e792f5048502d50657273697374656e63652d4150492e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sweiguny/PHP-Persistence-API)

The PHP Persistence API (`PPA`) is an Interface for PHP-Applications to access Object-Relational data.

Note: this project currently underlies a huge refactoring process.
------------------------------------------------------------------

[](#note-this-project-currently-underlies-a-huge-refactoring-process)

---

#### Features:

[](#features)

- [Easy to embed in your project](https://github.com/sweiguny/PHP-Persistence-API/wiki/Embedding-PPA)
- Configure entities via [annotations](https://github.com/sweiguny/PHP-Persistence-API/wiki/Annotations-&-Parameters)
    - Relations
        - OneToOne
        - OneToMany
        - ManyToMany
- [TypedQueries](https://github.com/sweiguny/PHP-Persistence-API/wiki/TypedQuery) and [PreparedQueries](https://github.com/sweiguny/PHP-Persistence-API/wiki/PreparedQuery).
- CRUD
    - Transactions
- [Eager &amp; Lazy Loading](https://github.com/sweiguny/PHP-Persistence-API/wiki/Eager-and-Lazy-Loading)
- A neat [WIKI](https://github.com/sweiguny/PHP-Persistence-API/wiki)

**Features in spe:**

- Inheritance

---

### Examples:

[](#examples)

**Configuring your entities:**

```
namespace PPA\examples\entity;
use PPA\core\Entity;

/**
 * @table(name="role")
 */
class Role extends Entity {

    /**
     * @id
     * @column(name="id")
     */
    private $id;

    /** @column(name="name") */
    private $name;

    /**
     * @manyToMany(fetch = "eager", mappedBy = "_PPA_examples_entity_Right")
     * @joinTable(name = "role2right", column = "role_id", x_column = "right_id")
     */
    private $rights = array();
}
```

---

**Retrieving data:**

A TypedQuery can automatically resolve all the relations and give an appropriate output.

```
$query = new \PPA\core\query\TypedQuery("SELECT * FROM `role` WHERE id = 1", "\\PPA\\examples\\entity\\Role");
$query->getSingleResult();

Returns:
PPA\examples\entity\Role Object
(
    [id:PPA\examples\entity\Role:private] => 1
    [name:PPA\examples\entity\Role:private] => admin
    [rights:PPA\examples\entity\Role:private] => Array
        (
            [0] => PPA\examples\entity\Right Object
                (
                    [id:PPA\examples\entity\Right:private] => 3
                    [desc:PPA\examples\entity\Right:private] => ch-pw
                )
            [1] => PPA\examples\entity\Right Object
                (
                    [id:PPA\examples\entity\Right:private] => 1
                    [desc:PPA\examples\entity\Right:private] => login
                )
        )
)
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

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/6e569bda5fc5e28d499886f56c3190c3b2d9027b8dd8c256dc538484d989fd5e?d=identicon)[sweiguny](/maintainers/sweiguny)

---

Top Contributors

[![sweiguny](https://avatars.githubusercontent.com/u/6470636?v=4)](https://github.com/sweiguny "sweiguny (104 commits)")

---

Tags

dbalentitiesormphp

### Embed Badge

![Health badge](/badges/sweiguny-php-persistence-api/health.svg)

```
[![Health](https://phpackages.com/badges/sweiguny-php-persistence-api/health.svg)](https://phpackages.com/packages/sweiguny-php-persistence-api)
```

###  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)
