{"id":16064380,"url":"https://github.com/envms/fluentpdo","last_synced_at":"2026-03-17T16:02:26.141Z","repository":{"id":37549545,"uuid":"3105560","full_name":"envms/fluentpdo","owner":"envms","description":"A PHP SQL query builder using PDO","archived":false,"fork":false,"pushed_at":"2023-11-08T16:57:49.000Z","size":410,"stargazers_count":931,"open_issues_count":49,"forks_count":187,"subscribers_count":57,"default_branch":"master","last_synced_at":"2025-12-21T08:14:27.176Z","etag":null,"topics":["builder","fluent","mysql","pdo","php","postgresql","query","sql"],"latest_commit_sha":null,"homepage":"http://envms.github.io/fluentpdo/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/envms.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-01-04T21:41:27.000Z","updated_at":"2025-12-11T23:37:09.000Z","dependencies_parsed_at":"2024-06-18T11:14:48.009Z","dependency_job_id":"58fc99f6-a06a-4c08-98ac-4cc5a6941d75","html_url":"https://github.com/envms/fluentpdo","commit_stats":{"total_commits":341,"total_committers":32,"mean_commits":10.65625,"dds":"0.49853372434017595","last_synced_commit":"1985e0e8406a56140f387bc9bec786b419cbeccc"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/envms/fluentpdo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envms%2Ffluentpdo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envms%2Ffluentpdo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envms%2Ffluentpdo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envms%2Ffluentpdo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/envms","download_url":"https://codeload.github.com/envms/fluentpdo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envms%2Ffluentpdo/sbom","scorecard":{"id":378458,"data":{"date":"2025-08-11","repo":{"name":"github.com/envms/fluentpdo","commit":"1985e0e8406a56140f387bc9bec786b419cbeccc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":2,"reason":"Found 6/29 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'","Warn: branch protection not enabled for branch 'legacy'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 7 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T14:48:26.298Z","repository_id":37549545,"created_at":"2025-08-18T14:48:26.298Z","updated_at":"2025-08-18T14:48:26.298Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30626906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T14:16:03.965Z","status":"ssl_error","status_checked_at":"2026-03-17T14:16:03.380Z","response_time":56,"last_error":"SSL_read: 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":["builder","fluent","mysql","pdo","php","postgresql","query","sql"],"created_at":"2024-10-09T05:06:39.749Z","updated_at":"2026-03-17T16:02:26.111Z","avatar_url":"https://github.com/envms.png","language":"PHP","readme":"# FluentPDO [![Build Status](https://secure.travis-ci.org/envms/fluentpdo.png?branch=master)](http://travis-ci.org/envms/fluentpdo) [![Maintainability](https://api.codeclimate.com/v1/badges/19210ca91c7055b89705/maintainability)](https://codeclimate.com/github/fpdo/fluentpdo/maintainability)\n\nFluentPDO is a PHP SQL query builder using PDO. It's a quick and light library featuring a smart join builder, which automatically creates table joins for you.\n\n## Features\n\n- Easy interface for creating robust queries\n- Supports any database compatible with PDO\n- Ability to build complex SELECT, INSERT, UPDATE \u0026 DELETE queries with little code\n- Type hinting for magic methods with code completion in smart IDEs\n\n## Versions\n\n#### Version 2.x\n\nThe stable release of FluentPDO and actively maintained. Officially supports PHP 7.3 to PHP 8.0,\nbut it can work with previous versions of PHP 7.\n\n#### Version 1.x\n\nThe legacy release of FluentPDO. It is no longer supported and will not be maintained or updated.\nThis version works with PHP 5.4 to 7.1.\n\n#### Version 3.x - alpha\n\nThis version is a full rewrite of Fluent from the ground up. Its main advantage is\nsignificantly less memory usage and much greater performance in query building. It also places\na few additional restrictions to make queries easier to read and maintain. Documentation has also\nbeen a very common request, and version 3 is being fully documented alongside development.\nDetails and metrics will be posted once available.\n\n## Reference\n\n[Sitepoint - Getting Started with FluentPDO](http://www.sitepoint.com/getting-started-fluentpdo/)\n\n## Installation\n\n### Composer\n\nThe preferred way to install FluentPDO is via [composer](http://getcomposer.org/).\n\nAdd the following line in your `composer.json` file:\n\n\t\"require\": {\n\t\t...\n\t\t\"envms/fluentpdo\": \"^2.2.0\"\n\t}\n\nupdate your dependencies with `composer update`, and you're done!\n\n### Download Zip\n\nIf you prefer not to use composer, download the latest release, create the directory `Envms/FluentPDO` in your library directory, and drop this repository into it. Finally, add:\n\n```php\nrequire '[lib-dir]/Envms/FluentPDO/src/Query.php';\n```\n\nto the top of your application. **Note:** You will need an autoloader to use FluentPDO without changing its source code.\n\n## Getting Started\n\nCreate a new PDO instance, and pass the instance to FluentPDO:\n\n```php\n$pdo = new PDO('mysql:dbname=fluentdb', 'user', 'password');\n$fluent = new \\Envms\\FluentPDO\\Query($pdo);\n```\n\nThen, creating queries is quick and easy:\n\n```php\n$query = $fluent-\u003efrom('comment')\n             -\u003ewhere('article.published_at \u003e ?', $date)\n             -\u003eorderBy('published_at DESC')\n             -\u003elimit(5);\n```\n\nwhich would build the query below:\n\n```mysql\nSELECT comment.*\nFROM comment\nLEFT JOIN article ON article.id = comment.article_id\nWHERE article.published_at \u003e ?\nORDER BY article.published_at DESC\nLIMIT 5\n```\n\nTo get data from the select, all we do is loop through the returned array:\n\n```php\nforeach ($query as $row) {\n    echo \"$row['title']\\n\";\n}\n```\n\n## Using the Smart Join Builder\n\nLet's start with a traditional join, below:\n\n```php\n$query = $fluent-\u003efrom('article')\n             -\u003eleftJoin('user ON user.id = article.user_id')\n             -\u003eselect('user.name');\n```\n\nThat's pretty verbose, and not very smart. If your tables use proper primary and foreign key names, you can shorten the above to:\n\n```php\n$query = $fluent-\u003efrom('article')\n             -\u003eleftJoin('user')\n             -\u003eselect('user.name');\n```\n\nThat's better, but not ideal. However, it would be even easier to **not write any joins**:\n\n```php\n$query = $fluent-\u003efrom('article')\n             -\u003eselect('user.name');\n```\n\nAwesome, right? FluentPDO is able to build the join for you, by you prepending the foreign table name to the requested column.\n\nAll three snippets above will create the exact same query:\n\n```mysql\nSELECT article.*, user.name \nFROM article \nLEFT JOIN user ON user.id = article.user_id\n```\n\n##### Close your connection\n\nFinally, it's always a good idea to free resources as soon as they are done with their duties:\n \n ```php\n$fluent-\u003eclose();\n```\n\n## CRUD Query Examples\n\n##### SELECT\n\n```php\n$query = $fluent-\u003efrom('article')-\u003ewhere('id', 1)-\u003efetch();\n$query = $fluent-\u003efrom('user', 1)-\u003efetch(); // shorter version if selecting one row by primary key\n```\n\n##### INSERT\n\n```php\n$values = array('title' =\u003e 'article 1', 'content' =\u003e 'content 1');\n\n$query = $fluent-\u003einsertInto('article')-\u003evalues($values)-\u003eexecute();\n$query = $fluent-\u003einsertInto('article', $values)-\u003eexecute(); // shorter version\n```\n\n##### UPDATE\n\n```php\n$set = array('published_at' =\u003e new FluentLiteral('NOW()'));\n\n$query = $fluent-\u003eupdate('article')-\u003eset($set)-\u003ewhere('id', 1)-\u003eexecute();\n$query = $fluent-\u003eupdate('article', $set, 1)-\u003eexecute(); // shorter version if updating one row by primary key\n```\n\n##### DELETE\n\n```php\n$query = $fluent-\u003edeleteFrom('article')-\u003ewhere('id', 1)-\u003eexecute();\n$query = $fluent-\u003edeleteFrom('article', 1)-\u003eexecute(); // shorter version if deleting one row by primary key\n```\n\n***Note**: INSERT, UPDATE and DELETE queries will only run after you call `-\u003eexecute()`*\n\n## License\n\nFree for commercial and non-commercial use under the [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) or [GPL 2.0](http://www.gnu.org/licenses/gpl-2.0.html) licenses.\n","funding_links":[],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenvms%2Ffluentpdo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenvms%2Ffluentpdo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenvms%2Ffluentpdo/lists"}