{"id":19526344,"url":"https://github.com/phpfui/mysqlslowqueryparser","last_synced_at":"2025-04-26T10:31:16.983Z","repository":{"id":55879793,"uuid":"318584777","full_name":"phpfui/MySQLSlowQueryParser","owner":"phpfui","description":"PHP MySQL Slow Query Parser","archived":false,"fork":false,"pushed_at":"2024-02-23T20:02:37.000Z","size":52,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-03-24T01:20:21.009Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phpfui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-12-04T17:13:57.000Z","updated_at":"2023-03-19T05:13:44.000Z","dependencies_parsed_at":"2024-02-23T21:23:09.126Z","dependency_job_id":"e1fcae5b-db6d-4134-99c4-cce62aed1898","html_url":"https://github.com/phpfui/MySQLSlowQueryParser","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpfui%2FMySQLSlowQueryParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpfui%2FMySQLSlowQueryParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpfui%2FMySQLSlowQueryParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpfui%2FMySQLSlowQueryParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpfui","download_url":"https://codeload.github.com/phpfui/MySQLSlowQueryParser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224032215,"owners_count":17244373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T01:09:35.827Z","updated_at":"2024-11-11T01:09:37.281Z","avatar_url":"https://github.com/phpfui.png","language":"PHP","readme":"# 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://img.shields.io/packagist/v/phpfui/mysql-slow-log-parser.svg)](https://packagist.org/packages/phpfui/mysql-slow-log-parser) ![](https://img.shields.io/badge/PHPStan-level%206-brightgreen.svg?style=flat)\n\nPHP Parser for MySQL and MariaDB Slow Query Logs featuring sortable results\n\n## Requirements\n * Modern PHP version\n * MySQL 5.7 or higher, or MariaDB\n\n## Usage\n~~~php\n$parser = new \\PHPFUI\\MySQLSlowQuery\\Parser($logFilePath);\n\n// Return the sessions in the file as array\n$sessions = $parser-\u003egetSessions();\n\n// Return all entries in file as array, or pass session number (0 based)\n$entries = $parser-\u003egetEntries();\n\nif (count($entries))\n  {\n  // Get the worst offender\n  $entry = $parser-\u003esortEntries()-\u003egetEntries()[0];\n  echo 'Query ' . implode(' ', $entry-\u003eQuery) . \" took {$entry-\u003eQuery_time} seconds at {$entry-\u003eTime}\\n\";\n\n  // Get the most rows examined\n  $entry = $parser-\u003esortEntries('Rows_examined', 'desc')-\u003egetEntries()[0];\n  echo 'Query ' . implode(' ', $entry-\u003eQuery) . \" looked at {$entry-\u003eRows_examined} rows\\n\";\n  }\n~~~\n\n## Entries\n**\\PHPFUI\\MySQLSlowQuery\\Entry** provides details on each query.\nSupported fields:\n * Time\n * User\n * Host\n * Id\n * Query_time\n * Lock_time\n * Rows_sent\n * Rows_examined\n * Query (array)\n * Session (zero based)\n\n**MariaDB** adds the following fields:\n * Thread_id\n * Schema\n * QC_hit\n * Rows_affected\n * Bytes_sent\n * Tmp_tables\n * Tmp_disk_tables\n * Tmp_table_sizes\n * Full_scan\n * Full_join\n * Tmp_table\n * Tmp_table_on_disk\n * Filesort\n * Filesort_on_disk\n * Merge_passes\n * Priority_queue\n * explain\n\n## Sessions\n**\\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.\nSupported fields:\n * Server\n * Version\n * Port\n * Transport\n\n## Sort Entries\nBy 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.\n\n## Full Class Documentation\n[PHPFUI/InstaDoc](http://phpfui.com/?n=PHPFUI%5CMySQLSlowQuery)\n\n## License\nDistributed under the MIT License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpfui%2Fmysqlslowqueryparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpfui%2Fmysqlslowqueryparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpfui%2Fmysqlslowqueryparser/lists"}