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 today

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 1% 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://avatars.githubusercontent.com/u/589330?v=4)[Travis Miller](/maintainers/solarsnowfall)[@solarsnowfall](https://github.com/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

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M117](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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