{"id":16294733,"url":"https://github.com/finesse/queryscribe","last_synced_at":"2026-05-05T14:08:05.433Z","repository":{"id":62504807,"uuid":"108525824","full_name":"Finesse/QueryScribe","owner":"Finesse","description":"Light SQL query builder designed for extensibility and flexibility","archived":false,"fork":false,"pushed_at":"2020-02-01T05:49:43.000Z","size":211,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-30T00:13:07.656Z","etag":null,"topics":["database","library","mysql","query-builder","sql","sqlite"],"latest_commit_sha":null,"homepage":"","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/Finesse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-27T09:20:17.000Z","updated_at":"2020-12-08T02:45:00.000Z","dependencies_parsed_at":"2022-11-02T10:01:43.260Z","dependency_job_id":null,"html_url":"https://github.com/Finesse/QueryScribe","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/Finesse/QueryScribe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Finesse%2FQueryScribe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Finesse%2FQueryScribe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Finesse%2FQueryScribe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Finesse%2FQueryScribe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Finesse","download_url":"https://codeload.github.com/Finesse/QueryScribe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Finesse%2FQueryScribe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32652595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["database","library","mysql","query-builder","sql","sqlite"],"created_at":"2024-10-10T20:16:18.639Z","updated_at":"2026-05-05T14:08:05.392Z","avatar_url":"https://github.com/Finesse.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Query Scribe\n\n[![Latest Stable Version](https://poser.pugx.org/finesse/query-scribe/v/stable)](https://packagist.org/packages/finesse/query-scribe)\n[![Total Downloads](https://poser.pugx.org/finesse/query-scribe/downloads)](https://packagist.org/packages/finesse/query-scribe)\n![PHP from Packagist](https://img.shields.io/packagist/php-v/finesse/query-scribe.svg)\n[![Test Status](https://github.com/finesse/QueryScribe/workflows/Test/badge.svg)](https://github.com/Finesse/QueryScribe/actions?workflow=Test)\n[![Maintainability](https://api.codeclimate.com/v1/badges/525db13d39d7b3cec367/maintainability)](https://codeclimate.com/github/Finesse/QueryScribe/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/525db13d39d7b3cec367/test_coverage)](https://codeclimate.com/github/Finesse/QueryScribe/test_coverage)\n\nProvides a convenient object syntax to build SQL queries. Compiles the queries to an SQL text with values for binding.\nDoesn't perform queries to database.\n\n```php\n$query = (new Query)\n    -\u003efrom('posts')\n    -\u003ewhere('level', '\u003e', 3)\n    -\u003ewhereIn('category_id', function ($query) {\n        $query\n            -\u003eaddSelect('id')\n            -\u003efrom('categories')\n            -\u003ewhere('categories.name', 'Interesting');\n    })\n    -\u003ewhere(new Raw('MONTH(date)'), 4)\n    -\u003eorderBy('date', 'desc')\n    -\u003elimit(10);\n    \n$prefixer = new TablePrefixer('demo_');\n$grammar = new MySQLGrammar();\n$compiled = $grammar-\u003ecompile($query-\u003eapply($prefixer));\n\necho $compiled-\u003egetSQL();\n/*\n    SELECT *\n    FROM `demo_posts`\n    WHERE\n        `level` \u003e ? AND\n        `category_id` IN (\n            SELECT `id`\n            FROM `demo_categories`\n            WHERE `demo_categories`.`name` = ?\n        ) AND\n        (MONTH(date)) = ?\n    ORDER BY `date` DESC\n    LIMIT ?\n */\n\necho $compiled-\u003egetBindings();\n/*\n    [3, 'Interesting', 4, 10]\n */\n```\n\nTo perform compiled queries to a database, use a database connector like [PDO](http://php.net/manual/en/book.pdo.php), \n[MicroDB](https://github.com/Finesse/MicroDB) or [DBAL](http://www.doctrine-project.org/projects/dbal.html) or use\na ready database abstraction like [MiniDB](https://github.com/Finesse/MiniDB) or \n[Wired](https://github.com/Finesse/Wired).\n\nKey features:\n\n* The builder has a single responsibility: build SQL.\n* Designed for further extension. You may build a database tool or an ORM on top of it without major problems. \n  Examples will come soon.\n* Very flexible. You can pass a [raw SQL or a subquery](#raw-sql-and-subqueries) almost everywhere (see the PHPDoc \n  comments in the code to know where you can pass them).\n* Smart table prefixes which consider table aliases (don't work in raw expressions).\n* All the values go to bindings, even from subqueries.\n* No dependencies. Requires only PHP ≥ 7.\n\nSupported SQL dialects:\n\n* MySQL\n* SQLite\n* ~~SQL Server~~ (not fully supported)\n* Maybe any other, didn't test it\n\nIf you need a dialect support please extend the `CommonGrammar` class and make a pull request.\n\n\n## Documentation\n\nThe documentation is available at [queryscribe.readthedocs.io](http://queryscribe.readthedocs.io).\n\nAlso all the classes, methods and properties has a PHPDoc comment in the code.\n\n\n## Versions compatibility\n\nThe project follows the [Semantic Versioning](http://semver.org).\n\n\n## License\n\nMIT. See [the LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinesse%2Fqueryscribe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffinesse%2Fqueryscribe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinesse%2Fqueryscribe/lists"}