PHPackages                             switon/db - 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. switon/db

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

switon/db
=========

Database connections, SQL execution, and transaction helpers for Switon Framework

v1.0.0(1mo ago)074MITPHPPHP &gt;=8.3CI passing

Since May 10Pushed 1mo agoCompare

[ Source](https://github.com/switon-php/db)[ Packagist](https://packagist.org/packages/switon/db)[ Docs](https://github.com/switon-php/db)[ RSS](/packages/switon-db/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (5)Versions (2)Used By (4)

Switon DB Package
=================

[](#switon-db-package)

Database connections, SQL execution, and transaction helpers for Switon Framework.

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

[](#installation)

```
composer require switon/db
```

**Requirements:** PHP 8.3+, `ext-pdo`, and a PDO driver extension such as `pdo_mysql`, `pdo_pgsql`, `pdo_sqlite`, or `pdo_sqlsrv`

Quick Start
-----------

[](#quick-start)

```
use Switon\Core\Attribute\Autowired;
use Switon\Db\ClientInterface;

class UserRepository
{
    #[Autowired] protected ClientInterface $db;

    public function findById(int $id): ?array
    {
        $rows = $this->db->fetchAll(
            'SELECT * FROM users WHERE id = :id LIMIT 1',
            ['id' => $id],
        );

        return $rows[0] ?? null;
    }
}
```

Docs:

License
-------

[](#license)

MIT.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance94

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

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

31d ago

### Community

Maintainers

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

---

Top Contributors

[![switon-php](https://avatars.githubusercontent.com/u/247358032?v=4)](https://github.com/switon-php "switon-php (5 commits)")

---

Tags

databasedbpdosqlswitontransactionsdatabasesqlpdotransactionsswiton

### Embed Badge

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

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

###  Alternatives

[doctrine/dbal

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

9.7k595.8M6.4k](/packages/doctrine-dbal)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.8M74](/packages/ifsnop-mysqldump-php)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4873.1M37](/packages/aura-sqlquery)[paragonie/easydb

Easy-to-use database abstraction

741280.1k24](/packages/paragonie-easydb)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k23.1k](/packages/clouddueling-mysqldump-php)[ezsql/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86848.3k](/packages/ezsql-ezsql)

PHPackages © 2026

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