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

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

mrcrmn/mysql
============

A easy to use wrapper for MySQL

0.1.1(8y ago)012MITPHP

Since Feb 25Pushed 8y agoCompare

[ Source](https://github.com/mrcrmn/mysql)[ Packagist](https://packagist.org/packages/mrcrmn/mysql)[ RSS](/packages/mrcrmn-mysql/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

MySQL
=====

[](#mysql)

A PDO wrapper for easy and intuitive MySQL database interaction.

### Installation

[](#installation)

To install run `composer require mrcrmn/mysql`
To use create a new Database object and connect it to the MySQL database.

```
$db = new Mrcrmn\Mysql\Database;
$db->connect($host, $user, $password, $port, $dbname);
```

### Usage

[](#usage)

This library support 4 basic actions for interaction with the database: "INSERT", "SELECT", "UPDATE", "DELETE".

#### INSERT

[](#insert)

```
$db->table('my_table')->insert([
   'foo' => 'bar',
   'baz' => 'foo'
]);
```

#### SELECT

[](#select)

Example:

```
$db->select('firstname as fn', 'lastname as ln')->from('customers')->where('lastname', 'smith')->get();
```

This returns the query result as an assoc array.

##### Available Methods

[](#available-methods)

```
$db->select(); // default = *
$db->select(['column_1', 'column_2']); // You may also just add as many arguments as you like without the array.
$db->into('table_name'); // Sets the table name.
$db->where('column_name', 'operator', 'value'); // If you don't pass the operator it defaults to '='.
$db->orWhere('column_name', 'operator', 'value'); // Same as a where, but with the OR before it.
$db->whereIn('column_name', ['value_1', 'value_2']); // Adds a where in subquery.
$db->orWhereIn('column_name', ['value_1', 'value_2']); // Take a guess.
$db->join('table_name', 'foreign_column_name', 'local_column_name'); // the local column name defaults to 'id'
$db->leftJoin('table_name', 'foreign_column_name', 'local_column_name');
$db->rightJoin('table_name', 'foreign_column_name', 'local_column_name');
$db->orderBy('column_name', 'ASC');
$db->groupBy('column_name');
$db->limit(1);
$db->offset(8);
$db->get(); // Executes the query and returns the result as an array.
$db->first(); // Gets the first entry.
$db->count(); // Gets the number of rows in the result.
$db->getQuery(); // Returns the built query as a string.
```

#### UPDATE

[](#update)

```
$db
    ->table('my_table')
    ->where('foo', 'baz')
    ->update([
       'foo' => 'bar',
       'baz' => 'foo'
    ]);
```

#### DELETE

[](#delete)

```
$db
    ->table('my_table')
    ->where('foo', 'baz')
    ->delete();
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

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

Every ~0 days

Total

2

Last Release

3047d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/357d5fbfbfdb185f5851cb1fcd8db3113ccbb41570a56b583fc23ab71b69638e?d=identicon)[mrcrmn](/maintainers/mrcrmn)

---

Top Contributors

[![mrcrmn](https://avatars.githubusercontent.com/u/30243531?v=4)](https://github.com/mrcrmn "mrcrmn (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/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)
