PHPackages                             saltid/lumen-repository - 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. [Framework](/categories/framework)
4. /
5. saltid/lumen-repository

ActiveLibrary[Framework](/categories/framework)

saltid/lumen-repository
=======================

Repository pattern for Lumen.

v1.0.2(3y ago)0120MITPHPPHP ^8.0

Since Feb 15Pushed 3y ago3 watchersCompare

[ Source](https://github.com/salt-id/lumen-repository)[ Packagist](https://packagist.org/packages/saltid/lumen-repository)[ RSS](/packages/saltid-lumen-repository/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Installation
============

[](#installation)

### System Requirements

[](#system-requirements)

StackVersion`PHP``^8.0``laravel/lumen-framework``^9.0``league/fractal``^0.20.1`### Composer

[](#composer)

This package is available on [Packagist](https://packagist.org/packages/saltid/lumen-repository) and can be installed using [Composer](https://getcomposer.org/):

```
$ composer require saltid/lumen-repository
```

Interfaces
==========

[](#interfaces)

The `SaltId\LumenRepository\Repositories\AbstractRepository` implementing below interfaces

- [SaltId\\LumenRepository\\Contracts\\RepositoryInterface](https://github.com/salt-id/lumen-repository/blob/master/src/Contracts/RepositoryInterface.php)
- [SaltId\\LumenRepository\\Contracts\\RepositoryCriteriaInterface](https://github.com/salt-id/lumen-repository/blob/master/src/Contracts/RepositoryCriteriaInterface.php)

`SaltId\LumenRepository\Criteria\AbstractCriteria` is implementing

- [SaltId\\LumenRepository\\Contracts\\CriteriaInterface](https://github.com/salt-id/lumen-repository/blob/master/src/Contracts/CriteriaInterface.php)

and `SaltId\LumenRepository\Criteria\RequestCriteria` is extending `SaltId\LumenRepository\Criteria\AbstractCriteria`

Criteria is useful for filtering your data, for example the default Criteria is `RequestCriteria` and has responsibility to handle search, orderBy, sortBy. You can create your own by extending the `AbstractCriteria` or implementing `CriteriaInterface` and push it to repository with method `pushCriteria(CriteriaInterface $criteria): static;`

Usage
=====

[](#usage)

Your **Model** should implements **`\SaltId\LumenRepository\Contracts\TransformableInterface`** and implementing **`transform(): array`** method

```

```

Create **Transformer** class and extend it with **`SaltId\LumenRepository\Transformers\TransformerAbstract`** and it will look like :

```
