PHPackages                             ezydb/ezydb - 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. ezydb/ezydb

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

ezydb/ezydb
===========

PHP library aimed at simplifying database interoperability and manipulation.

1.0.8(1y ago)21[3 issues](https://github.com/ricardolima-xyz/ezydb/issues)MITPHPPHP ^8.3CI passing

Since Mar 16Pushed 1y ago1 watchersCompare

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

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

ezydb
=====

[](#ezydb)

**ezydb** is a PHP library aimed at simplifying database interoperability and manipulation. It provides a foundational implementation of the [Data Access Object (DAO)](https://en.wikipedia.org/wiki/Data_access_object) design pattern, enabling basic [Create-Read-Update-Delete (CRUD)](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) operations with minimal SQL writing. Additionally, it includes utilities for SQL interoperability, making it easier to work with different database engines. With built-in support for prepared statements, it focuses on providing a secure and efficient way to interact with databases, while continuing to evolve as a project.

Testing
-------

[](#testing)

```
composer update
composer test
```

Notes - DAO
-----------

[](#notes---dao)

- Currently tested with MySQL, MariaDB, SQLite and PostgreSQL.
- It depends on PDO
- It is compatible with mysql if it uses ANSI mode. Make sure that tables were creaded in ANSI mode and set ANSI Mode when creating the PDO connection

```
$connection = new PDO(
    $connectionString, $dbUser, $dbPassword, [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET sql_mode="ANSI"']
);
```

Getting started - DAO
---------------------

[](#getting-started---dao)

Fist you need a database. In our example, we are using SQLite as our database engine.

```
    CREATE TABLE IF NOT EXISTS testEntity (
        id INTEGER PRIMARY KEY,
        columnone VARCHAR(255),
        columntwo DOUBLE PRECISION,
        active CHAR(1) DEFAULT '1'
    );
```

Now, in your code you start by creating your dao;

```
include_once 'dao.class.php';

$myDAO = new DAO(
    // PDO Connection string
    new PDO("sqlite:./test.sqlite"),
    // DB Table name
    'table',
    // Mapping of table column names and PDO param types
    [
        'id'            => PDO::PARAM_INT,
        'columnone'     => PDO::PARAM_STR,
        'columntwo'     => PDO::PARAM_STR,
        'active'        => PDO::PARAM_STR
    ],
    [
        // Defines which column is the primary key (requirement of this library)
        DAO::KEY                    => 'id',
        // Specifies whether the primary key is auto generated or not
        DAO::KEY_IS_AUTOGENERATED   => true
        // Specifies delete method, which could be deletion or deactivation
        DAO::DEL_METHOD             => DAO::DEL_METHOD_DEACTIVATE,
        // Case the delete method is deactivation, we should specify the column which serves as a flag
        // Deleted objects receive 0 and active objects receive 1.
        DAO::DEACTIVATE_COLUMN      => 'active'
    ]
);
```

Now you have an object which is ready to perform basic CRUD operations without writing one line of SQL:

```
// Creates a new object in the database. Note that id doesn't need to be specified if it
// is autogenerated in database and this information was passed in the constructor
$id = $myDAO->create(['columnone'=>'abc', columntwo=>'1.2']);

// Retrieves the object with given primary key
$object = $myDAO->get($id);

// Checks the existence of the object without retrieving it
$itExists =  $myDAO->exists($id);
$itDoesNotExist =  $myDAO->exists('BLAHBLAHBLAH');

// Retrieves a list of objects
$result = $myDAO->list();

// Deletes the object
$result = $myDAO->del($id);
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance25

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.8% 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

7

Last Release

428d ago

### Community

Maintainers

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

---

Top Contributors

[![ricardolima-xyz](https://avatars.githubusercontent.com/u/698278?v=4)](https://github.com/ricardolima-xyz "ricardolima-xyz (52 commits)")[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (14 commits)")

---

Tags

daodao-cruddao-design-patterndata-accessdatta-access-layerdatta-access-objectdesign-patterndesign-pattern-phpdesign-patternsiso-sqlphp-librarysqlsql-2019sql-translator

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

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

90440.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)
