{"id":28553899,"url":"https://github.com/siriusphp/sql","last_synced_at":"2026-05-06T08:36:08.205Z","repository":{"id":57051907,"uuid":"238872899","full_name":"siriusphp/sql","owner":"siriusphp","description":"Flexible query building library for PDO connections with a small API surface and auto-complete support (low cognitive load)","archived":false,"fork":false,"pushed_at":"2020-11-24T15:04:10.000Z","size":76,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-17T20:56:13.745Z","etag":null,"topics":["mysql","pdo","pdo-php","php","query","sql","sqlite"],"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/siriusphp.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-07T08:09:24.000Z","updated_at":"2020-11-24T15:03:14.000Z","dependencies_parsed_at":"2022-08-24T05:10:12.223Z","dependency_job_id":null,"html_url":"https://github.com/siriusphp/sql","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/siriusphp/sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siriusphp%2Fsql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siriusphp%2Fsql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siriusphp%2Fsql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siriusphp%2Fsql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siriusphp","download_url":"https://codeload.github.com/siriusphp/sql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siriusphp%2Fsql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32684965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["mysql","pdo","pdo-php","php","query","sql","sqlite"],"created_at":"2025-06-10T04:33:51.960Z","updated_at":"2026-05-06T08:36:08.200Z","avatar_url":"https://github.com/siriusphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sirius Sql\n\n[![Source Code](http://img.shields.io/badge/source-siriusphp/sql-blue.svg)](https://github.com/siriusphp/sql)\n[![Latest Version](https://img.shields.io/packagist/v/siriusphp/sql.svg)](https://github.com/siriusphp/sql/releases)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/siriusphp/sql/blob/master/LICENSE)\n[![Build Status](https://github.com/siriusphp/sql/workflows/CI/badge.svg)](https://github.com/siriusphp/sql/actions)\n[![Coverage Status](https://scrutinizer-ci.com/g/siriusphp/sql/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/siriusphp/sql/code-structure)\n[![Quality Score](https://scrutinizer-ci.com/g/siriusphp/sql/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/siriusphp/sql)\n\nThe `siriusphp/sql` library is designed to help you build and execute SQL simple and complex queries in a fast and safe way. \n\nThe vocabulary is as close to SQL as possible as you may see from the example below:\n\n```php\nuse Atlas\\Pdo\\Connection;\nuse Sirius\\Sql\\Select;\nuse Sirius\\Sql\\ConditionsEnum;\n\n$connection = Connection::new('sqlite::memory:');\n$select = new Select($connection);\n\n// find the 10 \"cool\" posts that are published and also retrieve the comments count\n$select-\u003edistinct()\n    -\u003ecolumns('posts.*', 'COUNT(comments.id) AS comments_count')\n    -\u003efrom('posts')\n    -\u003ejoin('LEFT', 'comments', 'comments.commentable_id = posts.id AND comments.commentable_type = %s', 'posts')\n    -\u003ewhere('posts.published_at \u003c NOW()')\n    -\u003ewhere('posts.title', 'cool', ConditionsEnum::CONTAINS)\n    -\u003egroupBy('posts.id')\n    -\u003elimit(10);\n\n$posts = $select-\u003efectchAll();\n```  \n\n## Links\n\n- [documentation](http://sirius.ro/php/sirius/sql/)\n- [changelog](CHANGELOG.md)\n\n\n## Acknowledgements\n\nThis library is a derivative work of [atlas/query](http://atlasphp.io/cassini/query/). I made this library for 2 reasons:\n- to reduce cognitive load by removing some methods and implementing other ways to achieve the same goals (eg: nested conditions)\n- to optimize some operations for the most common scenarios (eg: `where($column, $str, 'does_not_contain')` vs `where($column . ' LIKE ', '%' . $str . '%')`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiriusphp%2Fsql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiriusphp%2Fsql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiriusphp%2Fsql/lists"}