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

ActiveLibrary

pixxel/dbal
===========

A simple PDO wrapper / DBAL, with easier syntax than pdo

1.1.2(3y ago)03611MITPHPPHP &gt;= 7.4

Since Jun 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/pixxelfactory/DBAL)[ Packagist](https://packagist.org/packages/pixxel/dbal)[ RSS](/packages/pixxel-dbal/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (9)Dependencies (1)Versions (11)Used By (1)

Pixxel Dbal
===========

[](#pixxel-dbal)

This is a simple wrapper for PDO, since we hate its syntax and decided to sugar it up a bit with a simple class. Maybe we extend it in the future, but for now it serves its intended purpose (also, it's mysql only for now, but that will change).

### INSTALLATION

[](#installation)

#### A simple example to read from a table called pages(with manual installation / no composer):

[](#a-simple-example-to-read-from-a-table-called-pageswith-manual-installation--no-composer)

```
require_once(__DIR__.'/Pixxel/Dbal.php');

$dbal = new \Pixxel\Dbal('dbusername', 'dbpassword', 'dbname');
$pages = $dbal->read('select * from `pages` limit 20 order by `id` desc');

```

#### The same example install and usage with composer:

[](#the-same-example-install-and-usage-with-composer)

From the terminal (in the desired directory): composer require pixxel/dbal

Then, in that directory, create a php file and use this code:

```
require_once(__DIR__.'/vendor/autoload.php');

$dbal = new \Pixxel\Dbal('dbusername', 'dbpassword', 'dbname');
$pages = $dbal->read('select * from `pages` limit 20 order by `id` desc');

```

As you can see, its mostly normal sql, but without all the things around no one can remember like pdo connection strings and stuff with statements. Note that we always use prepared statements, so make sure that you use its biggest advantage, e.g. pass potentially vulnerable content as parameters:

```
$singlePage = $dbal->read('select * from `pages` where `id` = :id', [':id' => 5]);

```

This way you do not have to worry about sql-injection when passing in parameters that the user has control of. Here is a brief summary of what you can do with this class:

1.) Create a PDO connection:

```
$dbal = new \Pixxel\Dbal('dbusername', 'dbpassword', 'dbname');

```

2.) Select data:

```
$pages = $dbal->read('select * from `pages` limit 20 order by `id` desc');          // Return array containing objects
$pages = $dbal->readSingle('select * from `pages` limit 1 order by `id` desc');     // Return a single object, regardless of how many rows the query returns

```

3.) Insert, update or delete data:

```
$dbal->save('insert into `pages` (`title`, `content`) values (:title, :content)', [':title' => 'New page', ':content' => 'TitleMy content']);

```

4.) Get the id of the last inserted row:

```
$dbal->lastInsertId();

```

5.) Get the last sql error (for debugging purposes):

```
$dbal->lastError();

```

6.) Get the last executed query (or has been tried to execute):

```
$dbal->lastQuery();

```

That's all for now!

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

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

Every ~4 days

Total

10

Last Release

1376d ago

### Community

Maintainers

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

---

Top Contributors

[![pixxelfactory](https://avatars.githubusercontent.com/u/5260552?v=4)](https://github.com/pixxelfactory "pixxelfactory (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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