PHPackages                             coppolafab/micro-laravel-mysql-driver - 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. coppolafab/micro-laravel-mysql-driver

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

coppolafab/micro-laravel-mysql-driver
=====================================

A minimal extension of Laravel default behaviour to minimize interactions after connection towards a MySql Server

v1.0.3(5y ago)04.4kISCPHPPHP &gt;=7.2

Since May 3Pushed 5y ago1 watchersCompare

[ Source](https://github.com/coppolafab/micro-laravel-mysql-driver)[ Packagist](https://packagist.org/packages/coppolafab/micro-laravel-mysql-driver)[ Docs](https://github.com/coppolafab/micro-laravel-mysql-driver)[ RSS](/packages/coppolafab-micro-laravel-mysql-driver/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

What is this?
=============

[](#what-is-this)

A minimal extension of Laravel default behaviour to minimize interactions after connection towards a MySql Server. Compatible with Laravel 5.7+, 6.x and 7.x .

Why?
----

[](#why)

- `set names ...` statement affects only the server, causing possible differences on operations that involve charsets, especially while enabling prepared statement emulation.
    Setting connection charset via PDO DSN, instead, affect both client and server.
- Declaring the connection database into PDO DSN, allow to automatically select the db, without execute more statements.
    Also, some Connections Proxies do not allow execution of `use ${dbname}` statement.
- `set names ...` statement could be necessary if you need to specify a collation different from the server default for the specified charset. If you can stick with the default (ie. for utf8mb4, is utf8mb4\_general\_ci on MySQL 5.7 and utf8mb4\_0900\_ai\_ci on MySQL 8.0), you should unset `database.connections.mysql.collation`.
- Such configuration statements, can cause connection pinning on Proxies.
- When using Cluster with read-only Replicas, any script execution that also writes to the DB, handles 2 connections. If using stickiness, the read-only handle is unused and unnecessary occupying a MySQL thread.

#### MySQL general log output with default driver and config:

[](#mysql-general-log-output-with-default-driver-and-config)

```
2020-07-24T12:55:15.580117Z	    3 Connect	db_user@127.0.0.1 on db_schema using TCP/IP
2020-07-24T12:55:15.581060Z	    3 Query	use `db_schema`
2020-07-24T12:55:15.582896Z	    3 Prepare	set names 'utf8mb4'
2020-07-24T12:55:15.583003Z	    3 Execute	set names 'utf8mb4'
2020-07-24T12:55:15.583159Z	    3 Close stmt
2020-07-24T12:55:15.583256Z	    3 Prepare	set session sql_mode='NO_ENGINE_SUBSTITUTION'
2020-07-24T12:55:15.583331Z	    3 Execute	set session sql_mode='NO_ENGINE_SUBSTITUTION'
2020-07-24T12:55:15.583448Z	    3 Close stmt
2020-07-24T12:55:15.583531Z	    3 Query	select true

```

#### MySQL general log output with micro driver:

[](#mysql-general-log-output-with-micro-driver)

```
2020-07-24T12:51:18.507740Z	    2 Connect	db_user@127.0.0.1 on db_schema using TCP/IP
2020-07-24T12:51:18.509693Z	    2 Query	select true

```

This result can be obtained with all `database.connections.mysql.collation`, `database.connections.mysql.strict` and `database.connections.mysql.timezone` set to `NULL`.

What are the differences?
-------------------------

[](#what-are-the-differences)

- Set charset into PDO DSN.
- Do not execute the `use ${dbname}` statement, read from PDO DSN.
- Do not execute `set names ...` unless you provide an explicit `database.connections.mysql.collation`.
- When using Cluster with read-only Replicas, and `database.connections.mysql.sticky` is true, close immediately the read-only connection after the switch to the read-write instance.

How to use
----------

[](#how-to-use)

- Run `composer require coppolafab/micro-laravel-mysql-driver`
- Add database config options to the mysql section: ```
    'microOverrideDriver' => env('DB_MICROMYSQL_OVERRIDE_DRIVER', false),
    'microCloseReadConnectionAfterWrite' => env('DB_MICROMYSQL_CLOSE_READ_CONNECTION_AFTER_WRITE', false),

    ```
- Enable new config options via .env file: ```
    DB_MICROMYSQL_OVERRIDE_DRIVER=true
    DB_MICROMYSQL_CLOSE_READ_CONNECTION_AFTER_WRITE=true

    ```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~110 days

Total

4

Last Release

1922d ago

### Community

Maintainers

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

---

Top Contributors

[![coppolafab](https://avatars.githubusercontent.com/u/4855987?v=4)](https://github.com/coppolafab "coppolafab (2 commits)")[![friendzapp](https://avatars.githubusercontent.com/u/35966806?v=4)](https://github.com/friendzapp "friendzapp (1 commits)")

---

Tags

laraveldatabasemysqldriver

### Embed Badge

![Health badge](/badges/coppolafab-micro-laravel-mysql-driver/health.svg)

```
[![Health](https://phpackages.com/badges/coppolafab-micro-laravel-mysql-driver/health.svg)](https://phpackages.com/packages/coppolafab-micro-laravel-mysql-driver)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k32.6M46](/packages/kirschbaum-development-eloquent-power-joins)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)

PHPackages © 2026

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