PHPackages                             danmarinescu/db-layer - 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. danmarinescu/db-layer

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

danmarinescu/db-layer
=====================

Zend Framework 2 DB Layer providing easy access to DB without the need of a model , it returning a ResultSet

1.1(10y ago)034MITPHPPHP &gt;=5.3

Since Jul 11Pushed 10y ago1 watchersCompare

[ Source](https://github.com/marinescudan79/DbLayer)[ Packagist](https://packagist.org/packages/danmarinescu/db-layer)[ Docs](http://marinescudan79.github.io/DbLayer)[ RSS](/packages/danmarinescu-db-layer/feed)WikiDiscussions master Synced 1w ago

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

[![Build Status](https://camo.githubusercontent.com/8e491cf13c91f7d7d251fa599c80d262b7ec2b786ec5923dbd6a7bc70b23e582/68747470733a2f2f7472617669732d63692e6f72672f6d6172696e6573637564616e37392f44624c617965722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/marinescudan79/DbLayer)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e2f919143dd39917cbcf26460b6fd5f9c866b274211771cb38e7d7484d9f5e94/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6172696e6573637564616e37392f44624c617965722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/marinescudan79/DbLayer/?branch=master)[![Build Status](https://camo.githubusercontent.com/548173a5c17c9b3c25ccc6daa101e51050c91b82fd739c09036ef1c31360012b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6172696e6573637564616e37392f44624c617965722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/marinescudan79/DbLayer/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/a485f048bd1d2b43dfd2b6c0ca9b2f82ffd988ce3f38d1dd444b09a9ba1825af/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6172696e6573637564616e37392f44624c617965722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/marinescudan79/DbLayer/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/100b4fd059fcdd8f52545102021a4710eff15c5840695352c0cbfc9e18926d8f/68747470733a2f2f706f7365722e707567782e6f72672f64616e6d6172696e657363752f64622d6c617965722f762f737461626c65)](https://packagist.org/packages/danmarinescu/db-layer) [![Total Downloads](https://camo.githubusercontent.com/d7aca3a349994166c09bb9fc319fb81d6fd1dbf61006649857e40c7e656cb948/68747470733a2f2f706f7365722e707567782e6f72672f64616e6d6172696e657363752f64622d6c617965722f646f776e6c6f616473)](https://packagist.org/packages/danmarinescu/db-layer) [![Latest Unstable Version](https://camo.githubusercontent.com/73649dedae9eea0f6363d08157a2cda833803e6429399600811ede630a8ed2dd/68747470733a2f2f706f7365722e707567782e6f72672f64616e6d6172696e657363752f64622d6c617965722f762f756e737461626c65)](https://packagist.org/packages/danmarinescu/db-layer) [![License](https://camo.githubusercontent.com/2be5ccafad4cd3fa5cbc810ab6871ab875f87d617d504e89febd8a718260f45c/68747470733a2f2f706f7365722e707567782e6f72672f64616e6d6172696e657363752f64622d6c617965722f6c6963656e7365)](https://packagist.org/packages/danmarinescu/db-layer)DbLayer - README
=============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#---dblayer---readme)

Name: DbLayer Version: 1.0 Release date: 2015-07-11 Author: Dan Marinescu

Copyright (c) 2015: Dan Marinescu

Description: DbLayer is a PHP collection of classes for quering databases in ZendFramework2 on-the-fly without requiring extensions such as models or entities.

Layer Use:

```
Get intsnace of a DB Table :

    $tableInstance = $this->getServiceLocator()->get('DbLayerService')->get($tableName);

Method's provided by the $tableInstance :
    Select :
    $tableInstance->select()->fetchAll();
        Returning all records from a DB Table.

    $tableInstance->select()->fetchOne();
        Returning a single record from a DB Table.

    $tableInstance->select()->fetchPaginated($paginator);
        Returning paginated records from a DB Table ready to use with ZF2 pagination view helper.

    $tableInstance->insert($data);

    $tableInstance->update($data, $where);

    $data = array(
        'TableColumn' => 'TableValue',
        'TableColumn2' => 'TableValue2',
    );

    $tableInstance->delete($where);

    Layer instance methods :

        select($where) accepts an array with WHERE predicate conditions
            $where = array(
                'id = ?' => $id
            );

        join($join) accepts an array for joining other tables
            $join = array(
                array(
                    'table_name' => 'JoinedTable',
                    'join_condition' => 'Table.Id = JoinedTable.TableId',
                    'columns' => array('JoinedTableColumn', 'AliasedTableName' => 'JoinedTableColumn2'),
                    'join' => 'left',
                ),
                array(
                    'table_name' => 'JoinedTable',
                    'join_condition' => 'Table.Id = TableAliasName.TableId',
                    'columns' => array('JoinedTableAliasNameColumn', 'AliasedTableName' => 'JoinedTableAliasNameColumn2'),
                    'join' => 'left',
                    'alias' => 'TableAliasName'
                ),
            );

        limit(2) limiting results returned to 2

        order($order) ordering results
            $order = array(
                'Table.Id' => 'ASC',
                'JoinedTable.TableId' => 'DESC',
            );

        having($having)

        group($group)

```

Main Features:

Installation : composer require danmarinescu/db-layer

License: Copyright (C) 2015 Dan Marinescu

```
DbLayer is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

DbLayer is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.

```

============================================================

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

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

Total

3

Last Release

3986d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8be8a114d083026f21ebc3eb2baf6e076340db1194f24a05249d34fc0a52b77d?d=identicon)[danmarinescu79](/maintainers/danmarinescu79)

---

Top Contributors

[![marinescudan79](https://avatars.githubusercontent.com/u/11573538?v=4)](https://github.com/marinescudan79 "marinescudan79 (36 commits)")

---

Tags

databasezf2layerzend framework 2

### Embed Badge

![Health badge](/badges/danmarinescu-db-layer/health.svg)

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

###  Alternatives

[adodb/adodb-php

ADOdb is a PHP database abstraction layer library

4564.3M33](/packages/adodb-adodb-php)[tawfekov/zf2entityaudit

EntityAudit Module for Zend Framework2 , Doctrine2 and web interface

1910.4k](/packages/tawfekov-zf2entityaudit)[nitecon/zf2-db-session

Zend Framework 2 database session storage

204.8k](/packages/nitecon-zf2-db-session)

PHPackages © 2026

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