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

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

solarsnowfall/mysql-db
======================

A simple set of mysql wrappers for automating queries.

023PHP

Since Sep 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/solarsnowfall/mysql-db)[ Packagist](https://packagist.org/packages/solarsnowfall/mysql-db)[ RSS](/packages/solarsnowfall-mysql-db/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

MySql Db Automation
===================

[](#mysql-db-automation)

Provides static factory creation of datbase connection.

```
// config.php
include 'vender/autoload.php';

use Solar\Db\DbConnection;

DbConnection::initialize([
  'host'      => 'host',
  'user'      => 'user',
  'password'  => '********',
  'database'  => 'database'
]);

```

Then when you need it...

```
include 'config.php';

$db = DbConnection::getInstance();

```

Provides a wrapper which enforces a prepared statement only paradigm.

```
$stmt = $db->execute($sql, $params, $types);

$rows = $stmt->fetchAllAssoc();

```

Map table rows to objects by extending the AbstractRow.

```
use Solar\Db\Table\Row\AbstractRow;

class User extends AbstractRow
{
  const TABLE = 'user';

  protected ?string $email = null;

  protected ?string $fullName = null;

  protected ?int $id = null;
}

```

Map rows to your objects using the table gateway.

```
use Solar\Db\Table\Gateway;

$gateway = new Gateway(User::TABLE);
$user = $gateway->fetchRow(['id' => 1], User::class);

```

Access properties with smart magic accessors and mutators.

```
class User extends AbstractRow
{
  const MAGIC_GETTERS   = true;
  const MAGIC_SETTERS   = true;
  const TABLE           = 'user';
  ...
}

```

Zend Db insprited query automation. This mostly exists to facilitate the table and row gateways, but most workaday queries can be handled.

```
use Solar\Db\Sql\Sql;

$sql = new Sql();

$insert = $sql->insert();

$index = $insert->columns(['email', 'full_name'])
    ->into('user')
    ->set(['janedoe@gmail.com', 'Jane Doe'])
    ->execute();

```

Or just do it from your class.

```
// Returns a fully formed primary key array.
$index = $user->setEmail($email)->setFullName($fullName)->insert();

```

Use the speedy cached schema interface to know a little more about your database.

```
use Solar\Db\Table\Schema;

$table = Schema(User::TABLE);

$paramTypes = $table->getParamTypes($columns);

```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![solarsnowfall](https://avatars.githubusercontent.com/u/589330?v=4)](https://github.com/solarsnowfall "solarsnowfall (48 commits)")

### Embed Badge

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

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

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

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