PHPackages                             solleer/maphper-loader - 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. solleer/maphper-loader

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

solleer/maphper-loader
======================

v3.1(6y ago)12891PHP

Since Apr 25Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Sollee-Development/Maphper-Loader)[ Packagist](https://packagist.org/packages/solleer/maphper-loader)[ RSS](/packages/solleer-maphper-loader/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (8)Dependencies (2)Versions (10)Used By (1)

Maphper-Loader
==============

[](#maphper-loader)

An Easy Way to Create Maphper Instances

Dependencies
------------

[](#dependencies)

This library has dependencies on Dice and Maphper with can both be found at [Level-2](https://github.com/Level-2)

Purpose
-------

[](#purpose)

This project was started to make it easier to create instances of the Maphper class found at Level-2 with little configuration Each Loader just requires a file to be passed to it and you can call the `getMaphper` method to get the maphper you want

Use
---

[](#use)

Lets take this first example from Maphper's README

```
$pdo = new PDO('mysql:dbname=maphpertest;host=127.0.0.1', 'username', 'password');
$blogSource = new \Maphper\DataSource\Database($pdo, 'blog', 'id');
$blogs = new \Maphper\Maphper($blogSource);
```

This can be changed to have a file called `config.json` with the maphper config info config.json

```
{
    "blogs" : {
        "type" : "database",
        "table" : "blog",
        "primaryKey" : "id"
    }
}
```

And then the php becomes

```
$loader = new \MaphperLoader\Json("config.json", new \Dice\Dice());
$blogs = $loader->getMaphper("blogs");
```

MaphperLoader uses dice to handle dependencies such as PDO. You just need to add a rule for PDO and you are all set.

Relations
---------

[](#relations)

MaphperLoader supports all Maphper relationships including: One, Many, and ManyMany

### One

[](#one)

Here is some sample JSON for a One Relationship

```
{
    "blog" : {
        "type" : "database",
        "table" : "blog",
        "primaryKey" : "id",
        "relations" : [
            {
                "name" : "author",
                "to" : "author",
                "type" : "one",
                "localKey" : "authorId",
                "foreignKey" : "id"
            }
        ]
    },
    "author" : {
        "type" : "database",
        "table" : "author",
        "primaryKey" : "id"
    }
}
```

A one relationship has the following properties

- `name` - the name of the relation when being accessed
- `to` - the maphper being connected to
- `type` - the type of relation
- `localKey` - the key in the current Maphper being linked from
- `foreignKey` - the key in the other Maphper being linker to

### Many

[](#many)

```
{
    "blog" : {
        "type" : "database",
        "table" : "blog",
        "primaryKey" : "id"
    },
    "author" : {
        "type" : "database",
        "table" : "author",
        "primaryKey" : "id",
        "relations" : [
            {
                "name" : "blogs",
                "to" : "blog",
                "type" : "many",
                "localKey" : "id",
                "foreignKey" : "authorId"
            }
        ]
    }
}
```

A many relation has the same properties of a One relation except the `type` is set to `many`

### ManyMany

[](#manymany)

```
{
    "actors" : {
        "type" : "database",
        "table" : "actor",
        "primaryKey" : "aid",
        "relations" : [
            {
                "name" : "movies",
                "to" : "movies",
                "type" : "ManyMany",
                "intermediate" : "cast",
                "intermediateKey" : "movieId",
                "foreignKey" : "mid"
            }
        ]
    },
    "movies" : {
        "type" : "database",
        "table" : "movie",
        "primaryKey" : "mid",
        "relations" : [
            {
                "name" : "actors",
                "to" : "actors",
                "type" : "ManyMany",
                "intermediate" : "cast",
                "intermediateKey" : "actorId",
                "foreignKey" : "aid"
            }
        ]
    },
    "cast" : {
        "type" : "database",
        "table" : "cast",
        "primaryKey" : ["movieId", "actorId"]
    }
}
```

A ManyMany relation must have an intermediate Maphper to connect the two Maphpers Both Maphpers being connected must also have the ManyMany relationship defined In the above example that is the cast Maphper

The ManyMany Relation has the following properties

- `name` - the name of the relation when being accessed
- `to` - the Maphper being connected to
- `type` - the type of relation, in this case "ManyMany"
- `intermediate` - the intermediate Maphper
- `intermediateKey` - the key of the column in the intermediate maphper that connects to the other Maphper
- `foreignKey` - must be the primary key of the other Maphper

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity69

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~107 days

Recently: every ~76 days

Total

8

Last Release

2553d ago

Major Versions

v1.1.2 → v2.0.02018-07-18

v2.0.0 → v3.0.02019-04-12

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16144751?v=4)[Richard](/maintainers/solleer)[@solleer](https://github.com/solleer)

---

Top Contributors

[![solleer](https://avatars.githubusercontent.com/u/16144751?v=4)](https://github.com/solleer "solleer (23 commits)")

---

Tags

diceloadermaphper-instancesmaphper-loaderpdo

### Embed Badge

![Health badge](/badges/solleer-maphper-loader/health.svg)

```
[![Health](https://phpackages.com/badges/solleer-maphper-loader/health.svg)](https://phpackages.com/packages/solleer-maphper-loader)
```

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