PHPackages                             nathanielrich/my-sql - 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. nathanielrich/my-sql

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

nathanielrich/my-sql
====================

a simple php class to handle mysql connections

115PHP

Since Jan 9Pushed 7y ago1 watchersCompare

[ Source](https://github.com/nathanielrich/mysql)[ Packagist](https://packagist.org/packages/nathanielrich/my-sql)[ RSS](/packages/nathanielrich-my-sql/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Nrich\\MySql
------------

[](#nrichmysql)

A simple MySql class.

### How to

[](#how-to)

init the database connection on construct

```
$sql = new Nrich\Mysql(
    'localhost',
    'root',
    'my-password',
    'my-database'
);

```

###### quering

[](#quering)

the mysql class escape every param.

```
$sql->query("SELECT * FROM my_table WHERE id = :id", [
    'id' => 77
]);

```

###### count the result.

[](#count-the-result)

```
if($sql->count()) ...

```

###### fetching (one)

[](#fetching-one)

```
$result = $sql->fetchOne();
$result = $sql->fetchOne(true); // optional as array

```

###### fetching (multiple)

[](#fetching-multiple)

```
$results = $sql->fetchAll();
$results = $sql->fetchAll(true); // optional as nested array

```

#### Helpers

[](#helpers)

##### Raw

[](#raw)

if you wanna pass a raw param the your mysql query use the static raw method.

```
$sql->query("SELECT * FROM my_table WHERE birthday < :DATE", [
    $sql::raw('NOW()'),
]);

```

##### Implode

[](#implode)

if you need an array in your query you can use the implode helper to implode the data

```
$sql->query("SELECT * FROM my_table WHERE id IN (:MY_IDS)", [
    'MY_IDS' => $sql::implode([1,2,3,4], ',')
]);

```

each param of array will get an own unique key an escaped like all other params..

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

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/7a93cebd760fd3e511c6ac694d30cf6c8ddea7d030074e8251de170c9983323a?d=identicon)[nathanielrich](/maintainers/nathanielrich)

---

Top Contributors

[![nathanielrich](https://avatars.githubusercontent.com/u/11367343?v=4)](https://github.com/nathanielrich "nathanielrich (3 commits)")

### Embed Badge

![Health badge](/badges/nathanielrich-my-sql/health.svg)

```
[![Health](https://phpackages.com/badges/nathanielrich-my-sql/health.svg)](https://phpackages.com/packages/nathanielrich-my-sql)
```

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