PHPackages                             maduser/argon-database - 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. maduser/argon-database

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

maduser/argon-database
======================

A PHP package for database interactions

1.0.0(9mo ago)051MITPHPPHP ^8.2CI passing

Since Jul 26Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/judus/argon-database)[ Packagist](https://packagist.org/packages/maduser/argon-database)[ RSS](/packages/maduser-argon-database/feed)WikiDiscussions master Synced 1mo ago

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

[![PHP](https://camo.githubusercontent.com/ce3e396e4f1bbbd326f628872a1414656d28065f2712cda0868d8eff07320aec/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e322b2d626c7565)](https://www.php.net/)[![Build](https://github.com/judus/argon-database/actions/workflows/php.yml/badge.svg)](https://github.com/judus/argon-database/actions)[![codecov](https://camo.githubusercontent.com/bab94b9b85f3e164176c15804eeace5ea8e90723f54c4f4119638a36deeb8047/68747470733a2f2f636f6465636f762e696f2f67682f6a756475732f6172676f6e2d64617461626173652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/judus/argon-database)[![Psalm Level](https://camo.githubusercontent.com/83bd693869a67d67be5c431ede13bb2ce6145846492d5c0538a0a18257e67e34/68747470733a2f2f73686570686572642e6465762f6769746875622f6a756475732f6172676f6e2d64617461626173652f636f7665726167652e737667)](https://shepherd.dev/github/judus/argon-database)[![Code Style](https://camo.githubusercontent.com/3228be89f864906adf15243b35e8c354bb3fe91c1c02f070563c5cfbef9f36cf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532307374796c652d5053522d2d31322d627269676874677265656e2e737667)](https://www.php-fig.org/psr/psr-12/)[![Latest Version](https://camo.githubusercontent.com/267264f5d5aa16d4699f29251c6c9f69430e4badc988d7f5d7b47dd0363e2c0e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6164757365722f6172676f6e2d64617461626173652e737667)](https://packagist.org/packages/maduser/argon-database)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

Argon Database
==============

[](#argon-database)

DBAL wrapper built on top of PDO for PHP 8.2+.

Features
--------

[](#features)

- Not a ORM
- PDO-based abstraction
- Strict typing everywhere
- DTO hydration
- Supports MySQL, Postgres, SQLite

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

[](#installation)

```
composer require maduser/argon-database
```

Creating a Client
-----------------

[](#creating-a-client)

Wrap your DB config in a `LazyConnectionProvider`, then pass to `QueryClient`.

```
use Maduser\Argon\Database\QueryClient;
use Maduser\Argon\Database\PDO\MySQL\MySQLConfig;
use Maduser\Argon\Database\PDO\LazyConnectionProvider;

$provider = new LazyConnectionProvider(
    new MySQLConfig('127.0.0.1', 3306, 'argondb', 'argon', 'secret')
);

$db = new QueryClient($provider);
```

Other drivers:

```
new PostgresConfig('127.0.0.1', 5432, 'argondb', 'argon', 'secret');
new SqliteConfig(__DIR__ . '/mydb.sqlite');
```

Query Usage
-----------

[](#query-usage)

### `fetchAll()`

[](#fetchall)

```
$rows = $db
    ->query('SELECT * FROM users WHERE active = :active', ['active' => true])
    ->fetchAll();
```

Returns: `list`

### `fetchOne()`

[](#fetchone)

```
$user = $db
    ->query('SELECT * FROM users WHERE id = :id', ['id' => 42])
    ->fetchOne();
```

Returns: `array | null`

### `execute()`

[](#execute)

```
$db->query('UPDATE users SET banned = true WHERE id = :id', ['id' => 666])
   ->execute();
```

Returns: `void`

### `file()`

[](#file)

```
$users = $db
    ->file(__DIR__ . '/queries/select_active_users.sql', ['limit' => 10])
    ->fetchAll();
```

Throws if the file is unreadable or empty.

Using DTOs with `RowMapper`
---------------------------

[](#using-dtos-with-rowmapper)

To hydrate rows into typed objects, implement `RowMapper` on your DTO:

```
use Maduser\Argon\Database\Contracts\RowMapper;

/**
 * @implements RowMapper
 */
final class User implements RowMapper
{
    public function __construct(
        public readonly int $id,
        public readonly string $email
    ) {}

    public static function map(array $row): self
    {
        return new self(
            id: (int) $row['id'],
            email: (string) $row['email']
        );
    }
}
```

Then hydrate:

```
/** @var list */
$users = $db
    ->query('SELECT * FROM users')
    ->fetchAllTo(User::class);

/** @var User|null */
$user = $db
    ->query('SELECT * FROM users WHERE id = :id', ['id' => 1])
    ->fetchOneTo(User::class);
```

Transactions
------------

[](#transactions)

```
$result = $db->transaction(function (QueryClient $trx) {
    $trx->query(...)->execute();
    return 'done';
});
```

Commits on success, rolls back on exception.

License
-------

[](#license)

MIT.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance56

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

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

296d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7fb9da5a15010d335622bf9f465a32ef79c8d1cffcd139c2a9114736b72e2c13?d=identicon)[jdu](/maintainers/jdu)

---

Top Contributors

[![judus](https://avatars.githubusercontent.com/u/1478654?v=4)](https://github.com/judus "judus (8 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/maduser-argon-database/health.svg)

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

###  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)[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)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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