PHPackages                             bauer01/unimapper-nette - 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. bauer01/unimapper-nette

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

bauer01/unimapper-nette
=======================

Official Nette extension for UniMapper

v1.2.1(10y ago)11.4k2[2 issues](https://github.com/unimapper/nette/issues)MITPHPPHP &gt;=5.4.0

Since Jan 15Pushed 9y ago4 watchersCompare

[ Source](https://github.com/unimapper/nette)[ Packagist](https://packagist.org/packages/bauer01/unimapper-nette)[ RSS](/packages/bauer01-unimapper-nette/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (5)Versions (18)Used By (0)

Unimapper Nette extension
=========================

[](#unimapper-nette-extension)

[![Build Status](https://camo.githubusercontent.com/509b0e529691529ced122872918ca60feb50031406257872e2a7e9606bb4b839/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f756e696d61707065722f6e657474652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/unimapper/nette)

Official Unimapper extension for Nette framework.

Install
-------

[](#install)

```
$ composer require unimapper/nette:@dev
```

### Nette 2.1 and higher

[](#nette-21-and-higher)

Register extension in `config.neon`.

```
extensions:
    unimapper: UniMapper\Nette\Extension
```

### Nette 2.0

[](#nette-20)

Register extension in `app/bootstrap.php`.

```
UniMapper\Nette\Extension::register($configurator);

return $configurator->createContainer();
```

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

[](#configuration)

```
unimapper:
    adapters:
        Mongo: @service
        MySQL: @anotherService
        ...
    cache: true
    namingConvention:
        entity: 'YourApp\Model\*'
        repository: 'YourApp\Repository\*Repository'
    api:
        enabled: false
        module: "Api"
        route: true
    panel:
        enabled: true
        ajax: true # log queries in AJAX requests
    profiler: true
    customQueries:
        - CustomQueryClass
        - ...
```

API
---

[](#api)

Creating new API for your application is very easy, all you need is presenter for every entity you have.

Remember that every API presenter should always extend **UniMapper\\Nette\\Api\\Presenter**.

```
namespace YourApp\ApiModule\Presenter;

class EntityPresenter extends \UniMapper\Nette\Api\Presenter
{
    ...
}
```

Now you can call standard API methods like:

### GET

[](#get)

- associate - common parameter used to tell which association should be included in response. Syntax should be like `?associate[]=property1&associate[]=property2` or `?associate=property1,property2`.

\*\* Response\*\*

```
{
    "body": {..}
}
```

#### /api/entity/id

[](#apientityid)

Get a single record.

#### /api/entity

[](#apientity)

Get all records.

- count - optional parameter, if `?count=true` set then items count number will be returned in response body instead data.
- limit - maximum limit is set to `10`. You can change it by overriding property `$maxLimit` in your API presenter descendant.
- offset
- [where](#filtering-data)

### PUT

[](#put)

#### /api/entity

[](#apientity-1)

Update all records with JSON data stored in request body. [Filtering](#filtering-data) can be set and response body contains number of affected records.

- [where](#filtering-data)

\*\* Response\*\*

```
{
    "body": 3,
    "success": true
}
```

#### /api/entity/id

[](#apientityid-1)

Update single record with JSON data stored in request body.

\*\* Response\*\*

```
{
    "success": true
}
```

### POST

[](#post)

Create new record with JSON data stored in request body and primary value of new entity returned in response body.

#### /api/entity

[](#apientity-2)

\*\* Response\*\*

```
{
    "success": true,
    "link": "url to created entity",
    "body": "id of created entity"
}
```

### DELETE

[](#delete)

#### /api/entity

[](#apientity-3)

Delete all records returned body contains number of deleted records.

- [where](#filtering-data)

\*\* Response\*\*

```
{
    "body": {..}
    "success": true
}
```

#### /api/entity/id

[](#apientityid-2)

Delete single record.

\*\* Response\*\*

```
{
    "success": true
}
```

### Custom API methods

[](#custom-api-methods)

You can even define your custom method.

```
namespace YourApp\ApiModule\Presenter;

class EntityPresenter extends \UniMapper\Nette\Api\Presenter
{
    public function actionYourCustomMethod($id)
    {
        ...
    }
}
```

Then you can make a requests like `/api/entity/1?action=yourCustomMehod`.

### Filtering data

[](#filtering-data)

Filter can be set as a GET parameter `where` in URL. It should be here a valid JSON format as described [here](http://unimapper.github.io/docs/reference/repository/#filtering-data).

### Error response

[](#error-response)

If some bad request detected or an error occurred the returned response can be like this:

```
{
    "success": false
    "code": 405,
    "messages": []
}
```

### Generating links

[](#generating-links)

In your templates just use standard Nette link macro.

- `{link :Api:Entity:get}`
- `{link :Api:Entity:get 1}`
- `{link :Api:Entity:put 1}`
- `{link :Api:Entity:post}`
- `{link :Api:Entity:action}`

### Usage

[](#usage)

You can even build another applications using this API, just register an official API adapter class `UniMapper\Nette\Api\Adapter` in your **config.neon**.

#### Custom request factory

[](#custom-request-factory)

For easier API queries you can register factory interface as a dynamic service in your **config.neon**.

```
services:
    - UniMapper\Nette\Api\ICustomRequestFactory
```

Usage in your reopistory can look like this:

```
class SomeRepository extends \UniMapper\Repository
{
    private $requestFactory;

    public function __construct(
        \UniMapper\Connection $connection,
        \UniMapper\Nette\Api\ICustomRequestFactory $requestFactory
    ) {
        parent::__construct($connection);
        $this->requestFactory;
    }

    public function getSomethingFromApi()
    {
        $this->requestFactory()->setResource("apiResource")->setAction("custom")->send();
    }
}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 94.5% 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 ~21 days

Recently: every ~37 days

Total

16

Last Release

3815d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1914c143b4e827fa11601a023a7520c3252daacccacbc8edc8647122dccd1ef?d=identicon)[bauer01](/maintainers/bauer01)

---

Top Contributors

[![bauer01](https://avatars.githubusercontent.com/u/551000?v=4)](https://github.com/bauer01 "bauer01 (120 commits)")[![vp](https://avatars.githubusercontent.com/u/526320?v=4)](https://github.com/vp "vp (7 commits)")

---

Tags

extensionnetteormunimapperphpnetteextensionunimapper

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/bauer01-unimapper-nette/health.svg)

```
[![Health](https://phpackages.com/badges/bauer01-unimapper-nette/health.svg)](https://phpackages.com/packages/bauer01-unimapper-nette)
```

###  Alternatives

[weirdan/doctrine-psalm-plugin

Stubs to let Psalm understand Doctrine better

876.9M50](/packages/weirdan-doctrine-psalm-plugin)[umbrellio/laravel-pg-extensions

Extensions for Postgres Laravel

102426.5k1](/packages/umbrellio-laravel-pg-extensions)[aerospike/aerospike-php

Aerospike PHP Extension Pre-Alpha

1613.2k](/packages/aerospike-aerospike-php)[modul-is/orm

Lightweight hybrid ORM/Explorer

1118.1k](/packages/modul-is-orm)

PHPackages © 2026

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