PHPackages                             phpfui/mysql-slow-log-parser - 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. phpfui/mysql-slow-log-parser

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

phpfui/mysql-slow-log-parser
============================

MySQL and MariaDB Slow Query Log Parser featuring sortable results

V1.1.3(9mo ago)33344MITPHPPHP &gt;=8.0 &lt;8.6CI passing

Since Dec 4Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/phpfui/MySQLSlowQueryParser)[ Packagist](https://packagist.org/packages/phpfui/mysql-slow-log-parser)[ Docs](http://phpfui.com/?n=PHPFUI\MySQLSlowQuery)[ RSS](/packages/phpfui-mysql-slow-log-parser/feed)WikiDiscussions master Synced yesterday

READMEChangelog (6)Dependencies (5)Versions (13)Used By (0)

PHPFUI\\MySQLSlowLog\\Parser [![Tests](https://github.com/phpfui/MySQLSlowQueryParser/actions/workflows/tests.yml/badge.svg)](https://github.com/phpfui/MySQLSlowQueryParser/actions?query=workflow%3Atests) [![Latest Packagist release](https://camo.githubusercontent.com/385cd1829ed2c591376f3d7ebfd620ed6f628f99108d5e988e2c518e20e8eaad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068706675692f6d7973716c2d736c6f772d6c6f672d7061727365722e737667)](https://packagist.org/packages/phpfui/mysql-slow-log-parser) [![](https://camo.githubusercontent.com/742e8be8005b1fe76a64a5d8f5e6a5d4f63bf315e9a44a6d23e4e11c76b0555f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230362d627269676874677265656e2e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/742e8be8005b1fe76a64a5d8f5e6a5d4f63bf315e9a44a6d23e4e11c76b0555f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230362d627269676874677265656e2e7376673f7374796c653d666c6174)
=========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#phpfuimysqlslowlogparser---)

PHP Parser for MySQL and MariaDB Slow Query Logs featuring sortable results

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

[](#requirements)

- Modern PHP version
- MySQL 5.7 or higher, or MariaDB

Usage
-----

[](#usage)

```
$parser = new \PHPFUI\MySQLSlowQuery\Parser($logFilePath);

// Return the sessions in the file as array
$sessions = $parser->getSessions();

// Return all entries in file as array, or pass session number (0 based)
$entries = $parser->getEntries();

if (count($entries))
  {
  // Get the worst offender
  $entry = $parser->sortEntries()->getEntries()[0];
  echo 'Query ' . implode(' ', $entry->Query) . " took {$entry->Query_time} seconds at {$entry->Time}\n";

  // Get the most rows examined
  $entry = $parser->sortEntries('Rows_examined', 'desc')->getEntries()[0];
  echo 'Query ' . implode(' ', $entry->Query) . " looked at {$entry->Rows_examined} rows\n";
  }
```

Entries
-------

[](#entries)

**\\PHPFUI\\MySQLSlowQuery\\Entry** provides details on each query. Supported fields:

- Time
- User
- Host
- Id
- Query\_time
- Lock\_time
- Rows\_sent
- Rows\_examined
- Query (array)
- Session (zero based)

**MariaDB** adds the following fields:

- Thread\_id
- Schema
- QC\_hit
- Rows\_affected
- Bytes\_sent
- Tmp\_tables
- Tmp\_disk\_tables
- Tmp\_table\_sizes
- Full\_scan
- Full\_join
- Tmp\_table
- Tmp\_table\_on\_disk
- Filesort
- Filesort\_on\_disk
- Merge\_passes
- Priority\_queue
- explain

Sessions
--------

[](#sessions)

**\\PHPFUI\\MySQLSlowQuery\\Session** contains MySQL server information and are created on server restarts and log flushes. Pass the zero based session number to getEntries for only that Session's entries. Supported fields:

- Server
- Version
- Port
- Transport

Sort Entries
------------

[](#sort-entries)

By default, entries are returned in log order, but call sortEntries on the Parser to sort by any valid field (parameter 1). Sort defaults to 'desc', anything else will sort ascending.

Full Class Documentation
------------------------

[](#full-class-documentation)

[PHPFUI/InstaDoc](http://phpfui.com/?n=PHPFUI%5CMySQLSlowQuery)

License
-------

[](#license)

Distributed under the MIT License.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance57

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 95.9% 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 ~163 days

Recently: every ~266 days

Total

12

Last Release

283d ago

PHP version history (8 changes)V1.0.0PHP &gt;=7.1

V1.0.5PHP &gt;=7.1 | &lt;8.1

V1.0.6PHP &gt;=7.4 &lt;8.2

V1.0.7PHP &gt;=7.4 &lt;8.3

V1.1PHP &gt;=8.0 &lt;8.3

V1.1.1PHP &gt;=8.0 &lt;8.4

V1.1.2PHP &gt;=8.0 &lt;8.5

V1.1.3PHP &gt;=8.0 &lt;8.6

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7434059?v=4)[Bruce Wells](/maintainers/PHPFUI)[@phpfui](https://github.com/phpfui)

---

Top Contributors

[![phpfui](https://avatars.githubusercontent.com/u/7434059?v=4)](https://github.com/phpfui "phpfui (47 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![rmuit](https://avatars.githubusercontent.com/u/153133?v=4)](https://github.com/rmuit "rmuit (1 commits)")

---

Tags

logparsermysqlmariadbqueryslow

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phpfui-mysql-slow-log-parser/health.svg)

```
[![Health](https://phpackages.com/badges/phpfui-mysql-slow-log-parser/health.svg)](https://phpackages.com/packages/phpfui-mysql-slow-log-parser)
```

###  Alternatives

[nilportugues/sql-query-formatter

A very lightweight PHP class that reformats unreadable and computer-generated SQL query statements to human-friendly, readable text.

381.2M29](/packages/nilportugues-sql-query-formatter)[wazaari/monolog-mysql

A handler for Monolog that sends messages to MySQL

139910.7k6](/packages/wazaari-monolog-mysql)[chillerlan/php-database

An extensible database wrapper and query builder.

431.2k2](/packages/chillerlan-php-database)[addapp/laravel-query-log

Logs full mysql queries.

135.4k](/packages/addapp-laravel-query-log)[stefanfroemken/mysqlreport

MySQL Report - Analyze and profile your TYPO3 database queries

1318.6k](/packages/stefanfroemken-mysqlreport)

PHPackages © 2026

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