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

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

phpnomad/mysql-integration
==========================

1.2.1(3w ago)04.3k↓43.3%[1 issues](https://github.com/phpnomad/mysql-db-integration/issues)[2 PRs](https://github.com/phpnomad/mysql-db-integration/pulls)2MITPHPCI passing

Since Dec 18Pushed 3w ago2 watchersCompare

[ Source](https://github.com/phpnomad/mysql-db-integration)[ Packagist](https://packagist.org/packages/phpnomad/mysql-integration)[ Docs](https://github.com/phoenix/core)[ RSS](/packages/phpnomad-mysql-integration/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (8)Versions (22)Used By (2)

phpnomad/mysql-db-integration
=============================

[](#phpnomadmysql-db-integration)

[![Latest Version](https://camo.githubusercontent.com/7d3a80f3bcc5396696a918bf9d52c742931a277ae0d4fa1149ebf2100d0893eb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068706e6f6d61642f6d7973716c2d696e746567726174696f6e2e737667)](https://packagist.org/packages/phpnomad/mysql-integration)[![Total Downloads](https://camo.githubusercontent.com/15ce0aeab329d0819abc4c555070c9f9b66016352b05a97af436dd943ed2f2b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068706e6f6d61642f6d7973716c2d696e746567726174696f6e2e737667)](https://packagist.org/packages/phpnomad/mysql-integration)[![PHP Version](https://camo.githubusercontent.com/842d83c447082f4cbc628a5a44da11fa025275e58de75a73fe2b08d24fd2a2e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7068706e6f6d61642f6d7973716c2d696e746567726174696f6e2e737667)](https://packagist.org/packages/phpnomad/mysql-integration)[![License](https://camo.githubusercontent.com/7c7cf21277c684a843cc25d3dd82048dc79989622830c43f45bff34641aa60e2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7068706e6f6d61642f6d7973716c2d696e746567726174696f6e2e737667)](https://packagist.org/packages/phpnomad/mysql-integration)

`phpnomad/mysql-db-integration` implements `phpnomad/db`'s query builders and table strategies for MySQL. It generates the SQL and delegates execution to a `DatabaseStrategy` bound in your container, so it does not open a MySQL connection on its own. Pair it with `phpnomad/safemysql-integration` for a ready-made driver, or supply your own if you want to run the queries through `mysqli` or `PDO` directly.

Installation
------------

[](#installation)

```
composer require phpnomad/mysql-integration
```

What This Provides
------------------

[](#what-this-provides)

- A `QueryBuilder` that handles SELECT, JOIN, GROUP BY, ORDER BY, LIMIT, and OFFSET against `phpnomad/db` tables
- A `ClauseBuilder` for WHERE conditions with AND/OR groups and the common comparison, `LIKE`, `IN`, `BETWEEN`, and null operators
- `QueryStrategy`, `TableCreateStrategy`, `TableDeleteStrategy`, `TableExistsStrategy`, and `TableUpdateStrategy` implementations that cover insert, update, delete, query, estimated count, and schema management
- `DatabaseDateAdapter` that round-trips `DateTime` objects through the `Y-m-d H:i:s` MySQL format
- A `Database` facade exposing `parse()` and `query()` for the bound `DatabaseStrategy`

Requirements
------------

[](#requirements)

- `phpnomad/db ^2.0`
- `phpnomad/loader ^1.0 || ^2.0`
- A `PHPNomad\MySql\Integration\Interfaces\DatabaseStrategy` implementation bound in the container. The `parse()` method uses SafeMySQL-style placeholders (`?s`, `?n`, `?a`), which `phpnomad/safemysql-integration` already implements.

Usage
-----

[](#usage)

Add `MySqlInitializer` to your bootstrapper's initializer list and bind a `DatabaseStrategy` in the container before loading. The initializer registers every builder, strategy, and adapter listed above.

```
