PHPackages                             wallygator/datalayer - 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. wallygator/datalayer

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

wallygator/datalayer
====================

The data layer is a persistent abstraction component of your database that PDO

020PHP

Since Jan 29Pushed 2y ago1 watchersCompare

[ Source](https://github.com/luizservelo/datalayer)[ Packagist](https://packagist.org/packages/wallygator/datalayer)[ RSS](/packages/wallygator-datalayer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Data Layer @Wallygator
======================

[](#data-layer-wallygator)

Forked from @Coffeecode/Datalayer
---------------------------------

[](#forked-from-coffeecodedatalayer)

###### The data layer is a persistent abstraction component of your database that PDO has prepared instructions for performing common routines such as registering, reading, editing, and removing data.

[](#the-data-layer-is-a-persistent-abstraction-component-of-your-database-that-pdo-has-prepared-instructions-for-performing-common-routines-such-as-registering-reading-editing-and-removing-data)

O data layer é um componente para abstração de persistência no seu banco de dados que usa PDO com prepared statements para executar rotinas comuns como cadastrar, ler, editar e remover dados.

About CoffeeCode
----------------

[](#about-coffeecode)

###### CoffeeCode is a set of small and optimized PHP components for common tasks. Held by Robson V. Leite and the UpInside team. With them you perform routine tasks with fewer lines, writing less and doing much more.

[](#coffeecode-is-a-set-of-small-and-optimized-php-components-for-common-tasks-held-by-robson-v-leite-and-the-upinside-team-with-them-you-perform-routine-tasks-with-fewer-lines-writing-less-and-doing-much-more)

CoffeeCode é um conjunto de pequenos e otimizados componentes PHP para tarefas comuns. Mantido por Robson V. Leite e a equipe UpInside. Com eles você executa tarefas rotineiras com poucas linhas, escrevendo menos e fazendo muito mais.

### Highlights

[](#highlights)

- Easy to set up (Fácil de configurar)
- Total CRUD asbtration (Asbtração total do CRUD)
- Create safe models (Crie de modelos seguros)
- Composer ready (Pronto para o composer)
- PSR-2 compliant (Compatível com PSR-2)

Installation
------------

[](#installation)

Data Layer is available via Composer:

```
"coffeecode/datalayer": "1.1.*"
```

or run

```
composer require coffeecode/datalayer
```

Documentation
-------------

[](#documentation)

###### For details on how to use the Data Layer, see the sample folder with details in the component directory

[](#for-details-on-how-to-use-the-data-layer-see-the-sample-folder-with-details-in-the-component-directory)

Para mais detalhes sobre como usar o Data Layer, veja a pasta de exemplo com detalhes no diretório do componente

#### connection

[](#connection)

###### To begin using the Data Layer, you need to connect to the database (MariaDB / MySql). For more connections [PDO connections manual on PHP.net](https://www.php.net/manual/pt_BR/pdo.drivers.php)

[](#to-begin-using-the-data-layer-you-need-to-connect-to-the-database-mariadb--mysql-for-more-connections-pdo-connections-manual-on-phpnet)

Para começar a usar o Data Layer precisamos de uma conexão com o seu banco de dados. Para ver as conexões possíveis acesse o [manual de conexões do PDO em PHP.net](https://www.php.net/manual/pt_BR/pdo.drivers.php)

```
define("DATA_LAYER_CONFIG", [
    "driver" => "mysql",
    "host" => "localhost",
    "port" => "3306",
    "dbname" => "datalayer_example",
    "username" => "root",
    "passwd" => "",
    "options" => [
        PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ,
        PDO::ATTR_CASE => PDO::CASE_NATURAL
    ]
]);
```

#### your model

[](#your-model)

###### The Data Layer is based on an MVC structure with the Layer Super Type and Active Record design patterns. Soon to consume it is necessary to create the model of your table and inherit the Data Layer.

[](#the-data-layer-is-based-on-an-mvc-structure-with-the-layer-super-type-and-active-record-design-patterns-soon-to-consume-it-is-necessary-to-create-the-model-of-your-table-and-inherit-the-data-layer)

O Data Layer é baseado em uma estrutura MVC com os padrões de projeto Layer Super Type e Active Record. Logo para consumir é necessário criar o modelo de sua tabela e herdar o Data Layer.

```
class User extends DataLayer
{
    /**
     * User constructor.
     */
    public function __construct()
    {
        //string "TABLE_NAME", array ["REQUIRED_FIELD_1", "REQUIRED_FIELD_2"], string "PRIMARY_KEY", bool "TIMESTAMPS"
        parent::__construct("users", ["first_name", "last_name"]);
    }
}
```

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5703ab03b1a157051fde73c4084c508f7672334bb722065e287d06225f885cba?d=identicon)[luizservelo](/maintainers/luizservelo)

### Embed Badge

![Health badge](/badges/wallygator-datalayer/health.svg)

```
[![Health](https://phpackages.com/badges/wallygator-datalayer/health.svg)](https://phpackages.com/packages/wallygator-datalayer)
```

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