PHPackages                             kaylathedev/dbal - 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. kaylathedev/dbal

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

kaylathedev/dbal
================

A database abstraction library for PHP.

0.01(8y ago)018MITPHPPHP &gt;=5.4.0

Since Aug 19Pushed 7y ago1 watchersCompare

[ Source](https://github.com/kaylathedev/dbal)[ Packagist](https://packagist.org/packages/kaylathedev/dbal)[ RSS](/packages/kaylathedev-dbal/feed)WikiDiscussions master Synced 2d ago

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

Waffle Systems DAL
==================

[](#waffle-systems-dal)

[![Build Status](https://camo.githubusercontent.com/7fb4af9d233a2173e6a2d2d1620ec280da8274de1bd7eeb8cd6c8e83445b8084/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f776166666c6573797374656d732f64616c2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/wafflesystems/dal/build-status/master)

A PHP library which provides an abstraction layer for data maniuplation.

Looking for examples, documentation, or crave info? [Go to the wiki.](https://github.com/wafflesystems/dal/wiki)

To start using this library, have composer require `wafflesystems/dal`.

*Note: Despite the repository name, this is a DBAL (Database Abstraction Layer).*

```
composer require wafflesystems/dal
```

This library contains a layer of abstraction to start interacting with your database. If you want something more involved or more abstract, I highly recommend you use [wafflesystems/model](https://github.com/wafflesystems/model) along with this library.

Crash Course
============

[](#crash-course)

*I will assume you are using MySQL with your existing PHP application.*

The `presidents` table must have the columns, `id`, `first_name`, `last_name`, `born`, and `died`.

Import the `DAL\MySQLDatabase`, and construct a new MySQLDatabase.

```
use DAL\MySQLDatabase;

$db = new MySQLDatabase();
```

Set the hostname, username, and password.

```
$db->setHost('localhost');
$db->setUsername('admin');
$db->setPassword('secretPA$$w0rd');
```

Create
------

[](#create)

Gather your data into an array, and create a new entry.

```
$entry = [
    'id' => 1,
    'first_name' => 'George',
    'last_name' => 'Washington',
    'birth_date' => '2/22/1732',
    'death_date' => ''
]
$db->create('presidents', $entry);
```

Read
----

[](#read)

Use `find` to find only 1 entry.

We'll be using the condition class to tell the database which entry we'll use.

```
use DAL\Condition;

$result = $db->find(Condition::equals('birth_date', '2/22/1732'));
echo $result['last_name'];
```

Use `findAll` to find multiple entries.

```
$results = $db->findAll(Condition::equals('first_name', 'George'));
foreach ($results as $result) {
    echo $result['birth_date'];
    echo "\n";
}
```

Update
------

[](#update)

Put the data into a new array to overwrite the database.

```
$entry = [
    'death_date' => '12/14/1799'
]
$db->update('presidents', $entry, Condition::equals('id', 1));
```

Delete
------

[](#delete)

This will delete all entries that matches the condition.

```
$db->delete('presidents', Condition::equals('id', 1));
```

BE CAREFUL! If the condition is null, or not given, then ALL entries will be deleted!

```
$db->delete('presidents'); // Will DELETE EVERY PRESIDENT!
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3190d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a53f074a0a7eead65bfb4ff4df3b1add7fd389ea9773ee112a5317594e9a307?d=identicon)[wafflestealer654](/maintainers/wafflestealer654)

---

Top Contributors

[![kaylathedev](https://avatars.githubusercontent.com/u/5334284?v=4)](https://github.com/kaylathedev "kaylathedev (2 commits)")

---

Tags

phpabstractiondatabasepdolayer

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[adodb/adodb-php

ADOdb is a PHP database abstraction layer library

4553.9M28](/packages/adodb-adodb-php)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k22.9k](/packages/clouddueling-mysqldump-php)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1814.6k11](/packages/popphp-pop-db)

PHPackages © 2026

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