{"id":15028040,"url":"https://github.com/ellisgl/geeklab-glpdo2","last_synced_at":"2025-08-19T11:09:13.661Z","repository":{"id":62509531,"uuid":"111272104","full_name":"ellisgl/GeekLab-GLPDO2","owner":"ellisgl","description":"PHP \u003e= 8.1 PDO Wrapper for Easy and Proper Bindings.","archived":false,"fork":false,"pushed_at":"2022-11-25T21:43:09.000Z","size":202,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"release","last_synced_at":"2025-07-31T03:35:42.170Z","etag":null,"topics":["binding","bindings","database","db","escape","mysql","pdo","pdo-mysql","pdo-php","pdo-wrapper","php","php8-1","php81","sql"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ellisgl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.BSD","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-19T06:57:51.000Z","updated_at":"2023-07-02T18:02:13.000Z","dependencies_parsed_at":"2023-01-22T15:45:23.973Z","dependency_job_id":null,"html_url":"https://github.com/ellisgl/GeekLab-GLPDO2","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/ellisgl/GeekLab-GLPDO2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellisgl%2FGeekLab-GLPDO2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellisgl%2FGeekLab-GLPDO2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellisgl%2FGeekLab-GLPDO2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellisgl%2FGeekLab-GLPDO2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ellisgl","download_url":"https://codeload.github.com/ellisgl/GeekLab-GLPDO2/tar.gz/refs/heads/release","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellisgl%2FGeekLab-GLPDO2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271143398,"owners_count":24706346,"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-19T02:00:09.176Z","response_time":63,"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":["binding","bindings","database","db","escape","mysql","pdo","pdo-mysql","pdo-php","pdo-wrapper","php","php8-1","php81","sql"],"created_at":"2024-09-24T20:07:31.466Z","updated_at":"2025-08-19T11:09:13.633Z","avatar_url":"https://github.com/ellisgl.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License: BSD](https://img.shields.io/badge/License-BSD-yellow.svg)](https://opensource.org/licenses/BSD-3-Clause)\n[![phpstan enabled](https://img.shields.io/badge/phpstan-enabled-green.svg)](https://github.com/phpstan/phpstan)\n[![Build Status](https://scrutinizer-ci.com/g/ellisgl/GeekLab-GLPDO2/badges/build.png?b=release)](https://scrutinizer-ci.com/g/ellisgl/GeekLab-GLPDO2/build-status/)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ellisgl/GeekLab-GLPDO2/badges/quality-score.png?b=release)](https://scrutinizer-ci.com/g/ellisgl/GeekLab-GLPDO2/?branch=release)\n[![Code Coverage](https://scrutinizer-ci.com/g/ellisgl/GeekLab-GLPDO2/badges/coverage.png?b=release)](https://scrutinizer-ci.com/g/ellisgl/GeekLab-GLPDO2/?branch=release)\n\nGeekLab\\GLPDO2\n============\n\nEasy to use PDO Wrapper for PHP \u003e= 8.1\n\n### Latest\n2022-11-25 (4.0.9)\n* Style fixes.\n\n### Features\n* Bind value by the correct type. E.g. Don't bind as a string where an integer bind should be.\n* Bindings are injected, so you can create your own!\n* Help prevent injections.\n* PSR1/2/4 Compliant.\n\n### Installation\ncomposer require geeklab/glpdo2\n\n### Todo\n* More tests, since we can test at many levels and implementations.\n* Better schema for testing.\n* Better docs.\n* More of a real wold example.\n* Reduce the complexity?\n\n### Basic Usage (Quick-N-Dirty)\n\n```\n\u003c?php\nerror_reporting(E_ALL);\nini_set('display_errors', '1');\n\ndefine('DS', DIRECTORY_SEPARATOR);\nrequire_once '..' . DS . '..' . DS . 'vendor' . DS . 'autoload.php';\n\n$dbConn    = new PDO('mysql:host=localhost;dbname=playground', 'root', '', [PDO::ATTR_ERRMODE =\u003e PDO::ERRMODE_EXCEPTION]);\n$db        = new \\GeekLab\\GLPDO2\\GLPDO2($dbConn);\n$Statement = new \\GeekLab\\GLPDO2\\Statement(GLPDO2\\Bindings\\MySQL\\MySQLBindingFactory::build());\n$start     = 0;\n$limit     = 5;\n\n$Statement-\u003esql('SELECT *')\n          -\u003esql('FROM (')\n          -\u003esql('          SELECT *')\n          -\u003esql('          FROM   `mock_data`')\n          -\u003esql('          LIMIT  ?, ?')-\u003ebInt($start)-\u003ebInt($limit)\n          -\u003esql('     ) SUBQ')\n          -\u003esql('ORDER BY `id` DESC;');\n\n// Show computedSQL statement\nprint_r($Statement-\u003egetComputed());\n\n$res = $db-\u003eselectRows($Statement);\n\nprint_r($res);\n```\n\n### Data Binding Methods\nStatement-\u003ebBool($value, optional boolean $null)\u003cbr/\u003e\nBinds a value as bool(true, false), with optional NULL value return.\n\nStatement-\u003ebBoolInt($value, optional boolean $null)\u003cbr/\u003e\nBinds a value as int(0, 1), with optional NULL value return.\n\nStatement-\u003ebDate($value, optional boolean $null)\u003cbr/\u003e\nBinds a value as a date (string - validated for YYYY-MM-DD), with optional NULL return.\n\nStatement-\u003ebDateTime($value, optional boolean $null)\u003cbr/\u003e\nBinds a value as a date time (string - validated for YYYY-MM-DD HH:MM:SS), with optional NULL return.\n\nStatement-\u003ebFloat($value, optional integer $decimals, optional boolean $null)\u003cbr/\u003e\nBinds a value aa a float, with decimal place (default of 3) and optional NULL return. Use '%%' instead of '?'.\n\nStatement-\u003ebInt($value, optional boolean $null)\u003cbr/\u003e\nBind a value as an integer, whith optional NULL return.\n\nStatement-\u003ebIntArray(array $data, integer $default)\u003cbr/\u003e\nConverts an array of integers to a comma separated values. Will output $default (which is 0) if $data is not an array. Used with IN() statements. Use '%%' instead of '?'.\n\nStatement-\u003ebJSON($data, optional boolean $null)\u003cbr/\u003e\nBinds a JSON object or string as a string, with optional NULL value. Throws JsonException.\n\nStatement-\u003ebLike($value, boolean $ends, boolean $starts)\u003cbr/\u003e\nBinds a value as a string for LIKE queries. $ends = \"ends with\", $starts = \"starts with\"\n\nStatement-\u003ebStr($value, optional boolean $null, optional \\PDO::PARAM_* $type)\u003cbr/\u003e\nBinds a value as a string, with optional NULL value return and optional PDO binding type (default \\PDO::PARAM_STR).\n\nStatement-\u003ebStrArr(array $values, optional string $default)\u003cbr/\u003e\nBinds a string converted array for use with IN statements. $default is used when value isn't an array, which the default is NULL. Use '%%' instead of '?'. \n\nStatement-\u003ebind($name, $value, \\PDO::PARAM_* $type)\u003cbr/\u003e\nBinds a value to a named parameter with option PDO binding type (default \\PDO::PARAM_STR)\n\nStatement-\u003ebRaw($value)\u003cbr/\u003e\nBinds a raw value to '%%' in the sql statement. This is unquoted and unescaped. Good for tables names and functions. Can be dangerous if not handled correctly.\n\n### Query Methods\nGLPDO-\u003equeryDelete(Statement $SQL)\u003cbr/\u003e\nRuns a delete query and returns numbers of affected rows.\n\nGLPDO-\u003equeryInsert(Statement $SQL)\u003cbr/\u003e\nRuns an insert query and returns the primary ID.\n\nGLPDO-\u003equeryUpdate(Statement $SQL)\u003cbr/\u003e\nRuns an update query and returns number of affect rows\n\nGLPDO-\u003eselectRows(Statement $SQL)\u003cbr/\u003e\nRun a normal query, returns multiple rows as an array of associative arrays, or false.\n\nGLPDO-\u003eselectRow(Statement $SQL)\u003cbr/\u003e\nRuns a normal query, returns a single row as an array, or false.\n\nGLPDO-\u003eselectValue(Statement $SQL, $column, $default)\u003cbr/\u003e\nRuns a normal query, returns a single column ($column) and can return a default (mixed $default = null) value is no value is in the column.\n\nGLPDO-\u003eselectRow(Statement $SQL)\u003cbr/\u003e\nRuns a normal query, returns a single row as an array.\n\nGLPDO-\u003ebeginTransaction()\u003cbr/\u003e\nBegins an SQL Transaction.\n\nGLPDO-\u003ecommit()\u003cbr/\u003e\nCommits an SQL Transaction.\n\nGLPDO-\u003einTransaction()\u003cbr/\u003e\nIs there a transaction in progress, returns bool.\n\n### Misc Methods\nStatement-\u003esql(string $text)\u003cbr/\u003e\nUsed to build up the SQL parameterized statement.\n\nStatement-\u003ereset()\u003cbr/\u003e\nUsed to reset Statement private variables. Usefully for creating multiple queries without having to create a new Statement object.\n\nStatement-\u003eexecute(\\PDO $PDO)\u003cbr/\u003e\nPrepares and executes the statement\n\nStatement-\u003egetComputed()\u003cbr/\u003e\nReturns what the compiled SQL query string might look like for debugging purposes.\n\n### Alternative Packages\n* https://github.com/nkt/flame\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fellisgl%2Fgeeklab-glpdo2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fellisgl%2Fgeeklab-glpdo2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fellisgl%2Fgeeklab-glpdo2/lists"}