{"id":19163690,"url":"https://github.com/stnc/pdo-database","last_synced_at":"2026-05-02T23:44:18.218Z","repository":{"id":36026809,"uuid":"40322740","full_name":"stnc/pdo-database","owner":"stnc","description":"a PDO database service provider for mysql","archived":false,"fork":false,"pushed_at":"2021-05-21T12:14:25.000Z","size":58,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-14T21:14:34.181Z","etag":null,"topics":["composer","metod","mysql","pdo","pdo-database","php"],"latest_commit_sha":null,"homepage":null,"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/stnc.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}},"created_at":"2015-08-06T19:18:49.000Z","updated_at":"2023-03-05T02:44:44.000Z","dependencies_parsed_at":"2022-08-18T00:05:16.680Z","dependency_job_id":null,"html_url":"https://github.com/stnc/pdo-database","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/stnc/pdo-database","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stnc%2Fpdo-database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stnc%2Fpdo-database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stnc%2Fpdo-database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stnc%2Fpdo-database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stnc","download_url":"https://codeload.github.com/stnc/pdo-database/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stnc%2Fpdo-database/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273987551,"owners_count":25202897,"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-07T02:00:09.463Z","response_time":67,"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","metod","mysql","pdo","pdo-database","php"],"created_at":"2024-11-09T09:16:20.737Z","updated_at":"2026-05-02T23:44:13.197Z","avatar_url":"https://github.com/stnc.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pdo-database\neasy ,basic ,simple mysql provider \u003cbr\u003e\nA super simple function that returns the full SQL query from your PDO statements\u003cbr\u003e\na PDO database service provider for mysql and portgreSQL\n\n# Composer install \ncomposer require stnc/pdo-database\n\n## 1. Installing-Connections \n```php\nrequire_once 'vendor/autoload.php';\n  define('DB_TYPE', 'mysql');\n  define('DB_HOST', 'localhost');\n  define('DB_NAME', 'wordpress');\n  define('DB_USER', 'root');\n  define('DB_PASS', '');\n  ```\n## 2. Connections\n```php\n/* //use 1 \nuse Stnc\\Db\\MysqlAdapter ;\n$db = new MysqlAdapter();\n*/\n\n/* //use 2\nuse Stnc\\Db\\MysqlAdapter as dbs;\n$db = new dbs();\n*/\n\n\n//use 3\n$db = new Stnc\\Db\\MysqlAdapter();\n$tableName = 'users';\n```\n## 3. Select multiple rows\n```php\n$q = \"SELECT * FROM \".$tableName;\n$array_expression = $db-\u003efetchAll ( $q );\nforeach ( $array_expression as $value ) {\n\techo  $value ['name'];\n\techo '\u003cbr\u003e';\n}\n```\n## 4. Select single row\n```php\n$tableName = 'wp_options';//wordpress \n$q = \"SELECT * FROM \".$tableName;\n$array_expression = $db-\u003efetch ( $q );\necho $array_expression ['name'];\n//or \n$q = 'SELECT * FROM '.$tableName.' where option_name=\"siteurl\" ';\n$array_expression = $db-\u003efetch ( $q );\nprint_r ($array_expression);\necho $array_expression ['option_name'];\n\n\n```\n## 5.  Query \n```php\n$q = \"ALTER TABLE users MODIFY COLUMN user_id  int(11) NOT NULL AUTO_INCREMENT FIRST\";\n$db-\u003equery ( $q );\n```\n## 6. insert data\n```php\n$data = array (\n\t\t'name' =\u003e \"john\",\n\t\t'lastname' =\u003e \"carter\",\n\t\t'status' =\u003e 1,\n\t\t'age' =\u003e 25 \n);\n\n\n$db-\u003einsert ( $tableName, $data );\n```\n## 7. update metod\n```php\n$data = array (\n\t\t'name' =\u003e \"john\",\n\t\t'lastname' =\u003e \"carter\",\n\t\t'status' =\u003e 1,\n\t\t'age' =\u003e 25 \n);\n$where = array (\n\t\t'user_id' =\u003e 1 \n);\n$db-\u003e update ( $tableName, $data, $where );\n```\n## 8. Delete metod\n```php\n$where = array (\n\t\t'user_id' =\u003e 1 \n);\n\nreturn $db-\u003edelete ( $tableName, $where );\n```\n\n\n## 9. last id \n```php\n$db-\u003elastID();\n```\n\n## 10. Orm Mass Updates\n\n```php\n$db-\u003etableName=$tableName;\n$db-\u003ewhere('id', '=', 1)-\u003eupdate2(['username' =\u003e'selman sedat']);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstnc%2Fpdo-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstnc%2Fpdo-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstnc%2Fpdo-database/lists"}