PHPackages                             kodols/php-mysql-library - 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. kodols/php-mysql-library

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

kodols/php-mysql-library
========================

A Simple MySQL Library for PHP

v1.2.0(3y ago)827.2k↑16.7%7MITPHPPHP ^5.4.0|~7.0|~8.0CI failing

Since Jan 24Pushed 3y ago3 watchersCompare

[ Source](https://github.com/kodols/php-mysql-library)[ Packagist](https://packagist.org/packages/kodols/php-mysql-library)[ Docs](http://www.kodols.com)[ RSS](/packages/kodols-php-mysql-library/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (22)Used By (0)

MySQL Library for PHP
=====================

[](#mysql-library-for-php)

[![Build Status](https://camo.githubusercontent.com/704838c7ec74959bd124db5582cf985d866167d3d3a1edcb1c82ecb8d003c5b7/68747470733a2f2f7472617669732d63692e6f72672f6b6f646f6c732f7068702d6d7973716c2d6c6962726172792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kodols/php-mysql-library)[![Latest Stable Version](https://camo.githubusercontent.com/19404447a8e369282cd6d715a97438d000d00854dfe6ec595acbd731212091b7/68747470733a2f2f706f7365722e707567782e6f72672f6b6f646f6c732f5048502d4d7953514c2d4c6962726172792f762f737461626c652e737667)](https://packagist.org/packages/kodols/php-mysql-library)[![Total Downloads](https://camo.githubusercontent.com/cbac4eeddc5bec53d936d38e950fb438f948d92ffd2a0e437c89f952a1d9db7b/68747470733a2f2f706f7365722e707567782e6f72672f6b6f646f6c732f5048502d4d7953514c2d4c6962726172792f646f776e6c6f6164732e737667)](packagist.org/packages/kodols/php-mysql-library)[![License](https://camo.githubusercontent.com/57a4f773c5f8a21102ae61025d4a9a732e1a8df17e3beebb413a89e8e8af3cef/68747470733a2f2f706f7365722e707567782e6f72672f6b6f646f6c732f5048502d4d7953514c2d4c6962726172792f6c6963656e73652e737667)](packagist.org/packages/kodols/php-mysql-library)

This library will give you access to everything you need from MySQL in PHP.

See our [Object Reference](https://github.com/kodols/PHP-MySQL-Library/wiki) to learn what is possible, or view our [demo folder](https://github.com/kodols/PHP-MySQL-Library/tree/master/demo) for examples.

About
-----

[](#about)

The library is a hybrid between PHP's PDO and generic query building.

Started as a helper class for in-house projects and grown into a usefull tool for Kodols Ltd. A decision was made to make this library public give others the chance to use a well oriented library for database management.

Library will keep getting support and upgrades as this has been become the goto library for Kodols Ltd. to use for our projects.

This library supports access to the native PDO methods, few helper methods to simplify commonly used methods and a query builder to really give you access to build cool statements.

### Prerequisites

[](#prerequisites)

This library will work on PHP 5.4 or later

### Installing

[](#installing)

You can clone this git repository into your project

```
git clone git://github.com/kodols/PHP-MySQL-Library.git

```

or you can use composer

```
composer require kodols/php-mysql-library

```

Deployment
----------

[](#deployment)

The integration process is very simple, you call the main library class, add a configuration and you are all set. However we would recommend spend some time to really prepare the environment so you get the best out of this library. The library is based in `src/` with its namespace `\Kodols\MySQL`. In our examples we will use a demo variable $KML (Kodols MySQL Library), but of course you can use any variable you like.

```
$KML = new \Kodols\MySQL\Library;

```

Once you have successfuly create the object you need to add MySQL connection details to it. The library supports multiple configurations attached and multiple connections established in the same request.

```
$config = $KML->newConfiguration();
$config->setHostname('my.host.com');
$config->setUsername('web');
$config->setPassword('42412');
$config->setDatabase('project');

```

The `$config` variable is `\Kodols\MySQL\Configuration` object, see Wiki for in depth details.

Once configuration is created you can attach it to the main library via `$KML->attachConfiguration($config);` and start using the library. However if your environment has multiple database endpoints, or maybe you have production, development and local environment, then you can setup it as follows:

```
$config = $KML->newConfiguration();
$config->setHostname('my.host.com');
...
$KML->attachConfiguration($config, 'live');

```

So when you call the server variable you can choose with of the server endpoints you want to use.

Contributors
------------

[](#contributors)

We welcome a good idea, bug fixes, suggestions and requests. This list will be updated every time a new contribution has been made.

- **Edgars Kohs** - *author* - [Kodols Ltd.](http://www.kodols.com)

License
-------

[](#license)

This project is licensed under the MIT License - see the [https://github.com/kodols/php-mysql-library/blob/master/LICENSE](LICENSE) file for details

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 88.1% 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 ~116 days

Recently: every ~346 days

Total

20

Last Release

1188d ago

PHP version history (3 changes)v1PHP &gt;=5.4.0

v1.1.3PHP ^5.4.0|~7.0

v1.2.0PHP ^5.4.0|~7.0|~8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19609789?v=4)[Kodols](/maintainers/kodols)[@kodols](https://github.com/kodols)

---

Top Contributors

[![ed9](https://avatars.githubusercontent.com/u/19610073?v=4)](https://github.com/ed9 "ed9 (52 commits)")[![photodude](https://avatars.githubusercontent.com/u/10253980?v=4)](https://github.com/photodude "photodude (4 commits)")[![ezitisitis](https://avatars.githubusercontent.com/u/6075434?v=4)](https://github.com/ezitisitis "ezitisitis (2 commits)")[![travelfundcouk](https://avatars.githubusercontent.com/u/35568249?v=4)](https://github.com/travelfundcouk "travelfundcouk (1 commits)")

---

Tags

phpdatabasemysqlpdoquerybuilder

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kodols-php-mysql-library/health.svg)

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

###  Alternatives

[envms/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

925511.7k13](/packages/envms-fluentpdo)[lichtner/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

921274.8k6](/packages/lichtner-fluentpdo)[fpdo/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

921244.9k7](/packages/fpdo-fluentpdo)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k22.9k](/packages/clouddueling-mysqldump-php)[codesvault/howdy-qb

Mysql Query Builder for WordPress

371.2k1](/packages/codesvault-howdy-qb)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1814.6k11](/packages/popphp-pop-db)

PHPackages © 2026

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