PHPackages                             itseasy/laminas-db - 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. itseasy/laminas-db

ActiveLibrary

itseasy/laminas-db
==================

Laminas Database Wrapper

v1.1.0(3y ago)01.6k1MITPHPPHP ^7.4 || ^8.0 || ^8.1

Since Nov 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/wiryonolau/laminas-db)[ Packagist](https://packagist.org/packages/itseasy/laminas-db)[ RSS](/packages/itseasy-laminas-db/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (5)Versions (5)Used By (0)

Laminas DB Wrapper
------------------

[](#laminas-db-wrapper)

Library wrapper for Laminas DB

### RepositoryAbstractServiceFactory

[](#repositoryabstractservicefactory)

Lazy repository Initiation for Laminas ServiceManager. Any service request end with Repository will be created automatically.

To use it put in the service\_factory in service config

```
return [
    "service" => [
        "abstract_factories" => [
            Itseasy\Repository\Factory\RepositoryAbstractServiceFactory::class
        ]
    ]
]
```

### GenericRepository

[](#genericrepository)

A Generic Repository class that will be call by RepositoryAbstractServiceFactory when use.

### AbstractRepository

[](#abstractrepository)

Abstract Repository class.

Any **FilterAware** function require **table** and **sqlFilter** define on construct

Available function

```
# Get Record by identifer
getRowByIdentifier(
    $value,
    string $identifier = "id",
    $objectPrototype
) : ResultInterface | $objectPrototype;

# Get Multiple Record by array of condition
getRows(
    array $where = [],
	?string $orders = null,
    ?int $offset = null,
    ?int $limit = null,
    $resultSetObjectPrototype = null,
    $objectPrototype = null
) : ResultInterface | $resultSetObjectPrototype | ArrayIterator;

# Get Row Count by array of condition
getRowCount(
    array $where = []
): int;

# Delete Record base on condition
delete(array $where = []): ResultInterface;

# Insert or update existing Record base on identifier
# $model must has a getter and getArrayCopy() function to read properties
public function upsert(
   	object $model,
	string $identifier = "id",
   	array $exclude_attributes = []
) : $model;

# Get Multiple Record base on filter given
# Filter will be converted to sql by predefined filter
getFilterAwareRows(
    string $filters = null,
    ?string $orders = null,
    ?int $offset = null,
    ?int $limit = null,
    $resultSetObjectPrototype = null,
    $objectPrototype = null
) : ResultInterface | $resultSetObjectPrototype | ArrayIterator;

# Get Record Count base on filter given
# Filter will be converted to sql by predefined filter
getFilterAwareRowCount(
    string $filters = null
) : int;

# Delete Record base on filter given
# Filter will be converted to sql by predefined filter
filterAwareDelete(string $filters = null) : ResultInterface;
```

### SqlFilter

[](#sqlfilter)

A helper class to adding filter sql query base on definition

#### RegexSqlFilter

[](#regexsqlfilter)

Using regex base sql filter. Value inside round bracket ( **(...)** ) in regex will be pass to callback function as argument All callback must return **Laminas\\Db\\Sql\\Predicate\\PredicateInterface**

All filter is running in orderly manner from top to bottom

Example

```
use Itseasy\Repository\AbstractRepository;
use Itseasy\Database\Sql\Filter\RegexSqlFilter;

class Repository extends AbstractRepository
{
    # Can be public / protected function
    protected function defineSqlFilter() : void
    {
        $this->setSqlFilter(new RegexSqlFilter([
            [
                "is:active", function ($status) {
                    $p = new Predicate();
                    return $p->equalTo("active", true);
                }
            ],
            [
                "id:(\d)", function ($id) {
                    $p = new Predicate();
                    return $p->equalTo("id", $id);
                }
            ],
            [
                "tech_creation_date:(\d{4}-\d{2}-\d{2}):(\d{4}-\d{2}-\d{2})", function($start_date, $end_date) {
                    return new Laminas\Db\Sql\Predicate\Between(
                        "tech_creation_date",
                        $start_date,
                        $end_date
                    );
                }
            ],
            [
                "([a-z0-9]+)", function($value) {
                    $value = str_replace(" ", "%", $value);
                	return new Laminas\Db\Sql\PredicateSet([
 	                    new Lamainas|Db\Sql\Predicate\Like("first_name", "%$value%"),
                        new Lamainas|Db\Sql\Predicate\Like("last_name", "%$value%"),
 			            new Lamainas|Db\Sql\Predicate\Like("email", "%$value%"),
                    ], Laminas\Db\Sql\Predicate\PredicateSet::COMBINED_BY_AND );
                }
            ]
        ]));
    }
}

# Usage
$repository = new Repository($db, "mytable");
$repository->getFilterAwareRows("id:12", "id DESC", 0, 10);
$repository->getFilterAwareRows("tech_creation_date:2022-01-01:2022-03-01", null, 0, 10);
$repository->getFilterAwareRows("is:active somebody");
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

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 ~175 days

Total

3

Last Release

1281d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/685e9ba7c8a905c121c746487ac6790986287a73ce30083721dd1e4763ef3ca4?d=identicon)[wiryono](/maintainers/wiryono)

---

Top Contributors

[![wiryonolau](https://avatars.githubusercontent.com/u/9910819?v=4)](https://github.com/wiryonolau "wiryonolau (121 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/itseasy-laminas-db/health.svg)

```
[![Health](https://phpackages.com/badges/itseasy-laminas-db/health.svg)](https://phpackages.com/packages/itseasy-laminas-db)
```

###  Alternatives

[mimmi20/browser-detector

Library to detect Browsers and Devices

48153.5k3](/packages/mimmi20-browser-detector)[samsonasik/error-hero-module

A Hero for your Laminas and Mezzio application to trap php errors &amp; exceptions

5233.4k1](/packages/samsonasik-error-hero-module)[lm-commons/lmc-user

A generic user registration and authentication module for Laminas. Supports Laminas\\Db and Doctrine2.

1880.7k5](/packages/lm-commons-lmc-user)

PHPackages © 2026

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