{"id":24669096,"url":"https://github.com/solution10/sql","last_synced_at":"2025-09-14T18:50:50.284Z","repository":{"id":34334385,"uuid":"38254495","full_name":"solution10/sql","owner":"solution10","description":"Completely standalone, expressive SQL query creator. No database or ORM needed.","archived":false,"fork":false,"pushed_at":"2015-07-26T09:30:47.000Z","size":240,"stargazers_count":8,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-25T03:48:39.258Z","etag":null,"topics":["composer-packages","database","php","sql"],"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/solution10.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-29T15:16:53.000Z","updated_at":"2022-12-27T22:34:34.000Z","dependencies_parsed_at":"2022-09-14T03:51:34.774Z","dependency_job_id":null,"html_url":"https://github.com/solution10/sql","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/solution10/sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fsql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fsql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fsql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fsql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solution10","download_url":"https://codeload.github.com/solution10/sql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fsql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275152021,"owners_count":25414445,"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-09-14T02:00:10.474Z","response_time":75,"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":["composer-packages","database","php","sql"],"created_at":"2025-01-26T09:19:30.783Z","updated_at":"2025-09-14T18:50:50.227Z","avatar_url":"https://github.com/solution10.png","language":"PHP","readme":"# Solution10\\SQL\n\nCompletely standalone, expressive SQL query creator. No database or ORM needed.\n\n[![Build Status](https://travis-ci.org/Solution10/sql.svg?branch=master)](https://travis-ci.org/Solution10/sql)\n[![Coverage Status](https://coveralls.io/repos/Solution10/sql/badge.png)](https://coveralls.io/r/Solution10/sql)\n\n[![Latest Stable Version](https://poser.pugx.org/solution10/sql/v/stable.svg)](https://packagist.org/packages/solution10/sql)\n[![Total Downloads](https://poser.pugx.org/solution10/sql/downloads.svg)](https://packagist.org/packages/solution10/sql)\n[![License](https://poser.pugx.org/solution10/sql/license.svg)](https://packagist.org/packages/solution10/sql)\n\n## Features\n\n- No database connection required, entirely standalone\n- Return SQL string and params in order for PDO queries\n- Support for MySQL and ANSI SQL variations\n- Complex queries (nested where, having etc)\n- Simple, expressive syntax\n- Can return query parts at any point\n\n## Installation\n\nInstallation is via composer, in the usual manner:\n\n```json\n{\n    \"require\": {\n        \"solution10/sql\": \"~1.0\"\n    }\n}\n```\n\n## Documentation\n\n### Simple Examples\n\nFor more detailed documentation, please check the /docs folder in the repo, or the Wiki.\n\n#### Select\n\n```php\n$query = (new Solution10\\SQL\\Select())\n    -\u003eselect(['users.name', 'locations.name'])\n    -\u003efrom('users')\n    -\u003ejoin('locations', 'users.location_id', '=', 'locations.id')\n    -\u003ewhere('users.id', '\u003e', 15)\n    -\u003elimit(25)\n    -\u003eoffset(10)\n    -\u003eorderBy('name', 'DESC');\n\n// Make use of an existing PDO object to actually run the query:\n$stmt = $pdo-\u003eprepare((string)$query);\n$stmt-\u003eexecute($query-\u003eparams());\n$rows = $stmt-\u003efetchAll();\n```\n\n#### Insert\n\n```php\n$query = (new Solution10\\SQL\\Insert())\n    -\u003etable('users')\n    -\u003evalues([\n        'name' =\u003e 'Alex',\n        'location_id' =\u003e 27\n    ]);\n\n// Use with PDO in exactly the same way as SELECT:\n$stmt = $pdo-\u003eprepare((string)$query);\n$stmt-\u003eexecute($query-\u003eparams());\n```\n\n#### Update\n\n```php\n$query = (new Solution10\\SQL\\Update())\n    -\u003etable('users')\n    -\u003ewhere('id', '=', 15)\n    -\u003evalues([\n        'name' =\u003e 'Alex',\n        'location_id' =\u003e 27\n    ]);\n\n// Use with PDO in exactly the same way as SELECT:\n$stmt = $pdo-\u003eprepare((string)$query);\n$stmt-\u003eexecute($query-\u003eparams());\n```\n\n#### Delete\n\n```php\n$query = (new Solution10\\SQL\\Delete())\n    -\u003etable('users')\n    -\u003ewhere('id', '=', 27)\n    -\u003elimit(1);\n\n// Use with PDO in exactly the same way as SELECT:\n$stmt = $pdo-\u003eprepare((string)$query);\n$stmt-\u003eexecute($query-\u003eparams());\n```\n\n#### Using other dialects\n\nBy default, S10\\SQL will assume that you're using an ANSI SQL compatible database. If you're using something\nelse, MySQL for instance, simply pass into the constructor the Dialect instance:\n\n```php\n$query = (new Solution10\\SQL\\Select(new Solution10\\SQL\\Dialect\\MySQL()))\n    -\u003eselect('*')\n    -\u003efrom('users')\n    -\u003elimit(10);\n```\n\nYou can also write your own dialects by implementing `Solution10\\SQL\\DialectInterface`.\n\n### Userguide\n\n[Check out the Wiki](https://github.com/Solution10/sql/wiki)\n\n(or the /docs folder in the repo)\n\n### API Docs\n\nFrom a checkout of this project, run:\n\n    $ make\n\nThis will create an api/ folder for you to peruse.\n\n## PHP Requirements\n\n- PHP \u003e= 5.4\n\n## Author\n\nAlex Gisby: [GitHub](http://github.com/alexgisby), [Twitter](http://twitter.com/alexgisby)\n\n## License\n\n[MIT](http://github.com/solution10/sql/tree/master/LICENSE.md)\n\n## Contributing\n\n[Contributors Notes](http://github.com/solution10/sql/tree/master/CONTRIBUTING.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolution10%2Fsql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolution10%2Fsql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolution10%2Fsql/lists"}