{"id":30509034,"url":"https://github.com/sshilko/php-sql-mydb","last_synced_at":"2025-08-25T23:35:43.577Z","repository":{"id":61308269,"uuid":"517320277","full_name":"sshilko/php-sql-mydb","owner":"sshilko","description":"PHP client for MySQL database","archived":false,"fork":false,"pushed_at":"2025-08-24T20:26:43.000Z","size":136146,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-24T20:58:44.807Z","etag":null,"topics":["mysql","php"],"latest_commit_sha":null,"homepage":"http://sshilko.com/php-sql-mydb/php/","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/sshilko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT","threat_model":null,"audit":null,"citation":"CITATION","codeowners":".github/CODEOWNERS","security":".github/SECURITY","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"sshilko","custom":"https://paypal.me/sergeishilko"}},"created_at":"2022-07-24T12:39:37.000Z","updated_at":"2023-01-31T20:06:34.000Z","dependencies_parsed_at":"2023-12-18T20:06:56.819Z","dependency_job_id":"0dcd2d19-40d3-43df-b983-0c6c39229fd8","html_url":"https://github.com/sshilko/php-sql-mydb","commit_stats":{"total_commits":245,"total_committers":1,"mean_commits":245.0,"dds":0.0,"last_synced_commit":"b8c216687229f10863e738a8df0d647f3a431f07"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sshilko/php-sql-mydb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshilko%2Fphp-sql-mydb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshilko%2Fphp-sql-mydb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshilko%2Fphp-sql-mydb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshilko%2Fphp-sql-mydb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sshilko","download_url":"https://codeload.github.com/sshilko/php-sql-mydb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshilko%2Fphp-sql-mydb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272148902,"owners_count":24882025,"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","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["mysql","php"],"created_at":"2025-08-25T23:35:38.865Z","updated_at":"2025-08-25T23:35:43.555Z","avatar_url":"https://github.com/sshilko.png","language":"PHP","funding_links":["https://github.com/sponsors/sshilko","https://paypal.me/sergeishilko"],"categories":[],"sub_categories":[],"readme":"\u003c!---\nThis file is part of the sshilko/php-sql-mydb package.\n\n(c) Sergei Shilko \u003ccontact@sshilko.com\u003e\n\nMIT License\n\nFor the full copyright and license information, please view the LICENSE\nfile that was distributed with this source code.\n\n@license https://opensource.org/licenses/mit-license.php MIT\n--\u003e\nMyDb - Component\n=================\n\u003cp align=\"left\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/status-active-success\" alt=\"Project status - active\"\u003e\n\t\u003ca href=\"https://packagist.org/packages/sshilko/php-sql-mydb\"\u003e\u003cimg src=\"https://poser.pugx.org/sshilko/php-sql-mydb/v/stable\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://packagist.org/packages/sshilko/php-sql-mydb/stats\"\u003e\u003cimg src=\"https://poser.pugx.org/sshilko/php-sql-mydb/downloads\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://packagist.org/packages/sshilko/php-sql-mydb\"\u003e\u003cimg src=\"https://poser.pugx.org/sshilko/php-sql-mydb/require/php\" alt=\"PHP Required Version\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://choosealicense.com/licenses/mit/\"\u003e\u003cimg src=\"https://poser.pugx.org/sshilko/php-sql-mydb/license\" alt=\"MIT License\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://psalm.dev/docs/running_psalm/command_line_usage/#shepherd\"\u003e\n    \u003cimg src=\"https://shepherd.dev/github/sshilko/php-sql-mydb/coverage.svg\" alt=\"Psalm Coverage\"\u003e\u003c/a\u003e\n    \u003cimg src=\"https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fsshilko%2Fphp-sql-mydb\u0026count_bg=%2379C83D\u0026title_bg=%23555555\u0026icon=\u0026icon_color=%23E7E7E7\u0026title=hits\u0026edge_flat=false\"/\u003e\n    \u003cimg src=\"https://img.shields.io/github/languages/code-size/sshilko/php-sql-mydb\" alt=\"Code size\"\u003e\n    \u003cbr /\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/sshilko/php-sql-mydb/pages/php/phpunit/phpunit-coverage-badge.svg\" alt=\"PHPUnit coverage\" /\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/sshilko/php-sql-mydb/pages/php/phpunit/phpunit-coverage-badge-classes.svg\" alt=\"PHPUnit classes coverage\" /\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/sshilko/php-sql-mydb/pages/php/phpunit/phpunit-coverage-badge-lines.svg\" alt=\"PHPUnit lines coverage\" /\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/sshilko/php-sql-mydb/pages/php/phpunit/phpunit-coverage-badge-methods.svg\" alt=\"PHPUnit methods coverage\" /\u003e\n    \u003cbr/\u003e\n    \u003ca href=\"https://sshilko.com/php-sql-mydb/php/phan/\"\u003e\u003cimg src=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phpphan.yml/badge.svg\" alt=\"8.1 Phan build\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://sshilko.com/php-sql-mydb/php/psalm/\"\u003e\u003cimg src=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phppsalm.yml/badge.svg\" alt=\"8.1 Psalm build\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://sshilko.com/php-sql-mydb/php/phpmd/\"\u003e\u003cimg src=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phpmd.yml/badge.svg\" alt=\"8.1 PHPMd build\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://sshilko.com/php-sql-mydb/php/phpstan/\"\u003e\u003cimg src=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phpstan.yml/badge.svg\" alt=\"8.1 PHPStan build\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://sshilko.com/php-sql-mydb/php/phpcs/\"\u003e\u003cimg src=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phpcs.yml/badge.svg\" alt=\"8.1 PHPCodeSniffer build\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://sshilko.com/php-sql-mydb/php/phpdoc/\"\u003e\u003cimg src=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phpdoc.yml/badge.svg\" alt=\"8.1 PHPDocumentor build\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://sshilko.com/php-sql-mydb/php/pdepend/\"\u003e\u003cimg src=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phppdepend.yml/badge.svg\" alt=\"8.1 Pdepend build\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://sshilko.com/php-sql-mydb/php/phpunit/html/\"\u003e\u003cimg src=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phpunit.yml/badge.svg\" alt=\"8.1 PHPUnit build\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phpunit80.yml\"\u003e\u003cimg src=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phpunit80.yml/badge.svg\" alt=\"8.0 PHPUnit build\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phpunit81.yml\"\u003e\u003cimg src=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phpunit81.yml/badge.svg\" alt=\"8.1 PHPUnit build\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phpunit82.yml\"\u003e\u003cimg src=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/phpunit82.yml/badge.svg\" alt=\"8.2 PHPUnit build\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/github-pages.yml\"\u003e\u003cimg src=\"https://github.com/sshilko/php-sql-mydb/actions/workflows/github-pages.yml/badge.svg\" alt=\"GithubPages build\"\u003e\u003c/a\u003e\n    \u003cbr/\u003e\n    \u003c/p\u003e\n\n\u003c/p\u003e\n\nSimple PHP client for MySQL database\n\n#### Installation\n\n```\ncomposer require sshilko/php-sql-mydb\n```\n\n#### [Compatibility](https://sshilko.com/php-sql-mydb/php/)\n\n- PHP 8.0, 8.1, 8.2\n- MySQL \u003e=5.7.8, 8.0\n- MariaDB not compatible (TODO)\n\n#### How this client helps you talk SQL to MySQL server\n\n- Make MySQL behave like a “traditional” SQL database system\n  - `TRADITIONAL` mode, a simple description of this mode is [“give an error instead of a warning”](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_traditional)\n- Friendly transactions\n  - `autocommit = 0`\n  - explicit `commit` [on gracefull shutdown](https://dev.mysql.com/doc/refman/5.7/en/innodb-autocommit-commit-rollback.html)\n- Explicit timeouts\n  - 05 seconds `client-side` connect-timeout\n  - 89 seconds `server-side` SELECT query timeout\n  - 90 seconds `client-side` read-timeout for any query\n  - 7200 seconds non-interactive connection `idle timeout`\n  - `mysqlnd.net_read_timeout`\n  - respect client disconnect in php-fpm `function.ignore-user-abort.php`\n- Performance boost\n  - increased `MYSQLI_OPT_NET_READ_BUFFER_SIZE`\n  - increased `MYSQLI_OPT_NET_CMD_BUFFER_SIZE`\n  - read-only InnoDB [optimizations](https://dev.mysql.com/doc/refman/5.6/en/innodb-performance-ro-txn.html)\n  - READ COMMITED session transaction isolation level for readonly connections\n  - async command execution\n  - move mysql resultset to PHP userspace memory `MYSQLI_STORE_RESULT_COPY_DATA`\n  - use of `fetch_all` from [PHP Mysql native driver](https://www.php.net/manual/en/intro.mysqlnd.php)\n- UTF-8\n  - `utf8mb4` character set\n  - `UTC` timezone\n- Quality error handling\n  - PHP default error-reporting `E_ALL \u0026 ~E_WARNING \u0026 ~E_NOTICE`\n  - MySQL default error-reporting `MYSQLI_REPORT_ALL ^ MYSQLI_REPORT_STRICT ^ MYSQLI_REPORT_INDEX`\n  - `SIGTERM, SIGINT, SIGHUP` signals trap\n  - connection retry\n- PHPUnit \u0026 Static code analysis\n  - unit-tested, static analysed codebase\n\n#### What is the best use-case for this library\n\n- High performance, low-latency data-intensive applications\n- No prepared statements requirement\n- No 3rd party dependencies\n- No run-time/compile-time steps\n- Easy to start with and/or [integrate](https://refactoring.guru/design-patterns/php) into existing codebase\n\n#### Out of scope\n\nThis library is **not** intending to become a framework, to *keep focus* and minimize codebase, it does not provide\n\n- Input [validation](https://symfony.com/doc/current/validation.html), [API](https://refactoring.guru/design-patterns/facade) facade\n- [Object-relational mapping](https://en.wikipedia.org/wiki/Object–relational_mapping), ORM\n- [Active record](https://en.wikipedia.org/wiki/Active_record_pattern) pattern\n- [Repository](https://symfony.com/doc/current/doctrine.html#querying-for-objects-the-repository) pattern\n- Import and export of data\n\nplease re-use existing solutions that best fit your requirements.\n\n#### Why this library exists\n\n* MySQL database is fast, reliable and scalable, php runtime is the same\n* Value developers time and do not add complexity where possible\n* Measure app's performance with real-world datasets and organic load\n* Optimize for my use-case, focus on bottlenecks, remember that there is no ~~NoSQL~~ silver bullet\n* Do not optimize early - resources like CPU, memory are cheap\n* Focus on building architecture, learn from others and improve over time\n\n#### Future roadmap\n\n- MariaDB compatibility layer (variables and init command syntax is different between mysql and mariadb)\n- MydbFactory responsible for initializing defaults\n\n#### Contributing\n\n* Please read [contributing](CONTRIBUTING) document\n\n#### Authors\n\nSergei Shilko \u003ccontact@sshilko.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshilko%2Fphp-sql-mydb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsshilko%2Fphp-sql-mydb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshilko%2Fphp-sql-mydb/lists"}