{"id":23882606,"url":"https://github.com/kisphp/dbal","last_synced_at":"2026-04-21T03:31:54.933Z","repository":{"id":87045603,"uuid":"80557593","full_name":"kisphp/dbal","owner":"kisphp","description":"Kisphp Database Access Layer","archived":false,"fork":false,"pushed_at":"2017-10-08T17:10:53.000Z","size":14,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T01:34:09.994Z","etag":null,"topics":["kisphp","mysql","pdo","pdo-wrapper"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"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/kisphp.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-31T20:09:58.000Z","updated_at":"2021-11-08T19:45:39.000Z","dependencies_parsed_at":"2023-05-30T08:00:29.941Z","dependency_job_id":null,"html_url":"https://github.com/kisphp/dbal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kisphp/dbal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisphp%2Fdbal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisphp%2Fdbal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisphp%2Fdbal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisphp%2Fdbal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kisphp","download_url":"https://codeload.github.com/kisphp/dbal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisphp%2Fdbal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32075225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"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":["kisphp","mysql","pdo","pdo-wrapper"],"created_at":"2025-01-04T02:56:20.127Z","updated_at":"2026-04-21T03:31:54.928Z","avatar_url":"https://github.com/kisphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple MySQL Database Access Layer\n\n[![Build Status](https://travis-ci.org/kisphp/dbal.svg?branch=master)](https://travis-ci.org/kisphp/dbal)\n[![codecov](https://codecov.io/gh/kisphp/dbal/branch/master/graph/badge.svg)](https://codecov.io/gh/kisphp/dbal)\n\n## Installation\n\nRun in terminal\n\n```sh\ncomposer require kisphp/dbal: *\n```\n\n## Connect to database\n\n```php\n\u003c?php\n\nrequire_once 'path/to/vendor/autoload.php';\n\nuse Doctrine\\DBAL\\Configuration;\nuse Doctrine\\DBAL\\DriverManager;\nuse Kisphp\\Db\\Database;\nuse Kisphp\\Db\\DatabaseLog;\n\n$config = new Configuration();\n$connectionParams = [\n    'driver' =\u003e 'pdo_mysql',\n    'host' =\u003e 'localhost',\n    'dbname' =\u003e 'test',\n    'user' =\u003e 'root',\n    'password' =\u003e '',\n];\n\n$connection = DriverManager::getConnection($connectionParams, $config);\n\n$db = new Database($connection, new DatabaseLog());\n```\n\n## Database Insert\n\n\u003e `$db-\u003einsert('table_name', 'data array');`\n\nIf you need `INSERT IGNORE` syntax, then pass `true` for the third parameter\n\n```php\n$db-\u003einsert('test_table', [\n    'column_1' =\u003e 'value_1',\n    'column_2' =\u003e 'value_2',\n]);\n\n// will return last_insert_id\n\n$insertIgnore = true;\n$db-\u003einsert(\n    'test_table',\n    [\n        'column_1' =\u003e 'value_1',\n        'column_2' =\u003e 'value_2',\n    ],\n    $insertIgnore\n);\n// will execute INSERT IGNORE ...\n\n```\n\n## Database update\n\n\u003e `$db-\u003eupdate('table_name', 'data array', 'condition value', 'column name (default=id)');`\n\n```php\n$db-\u003eupdate('test_table', [\n    'column_1' =\u003e 'value_1',\n    'column_2' =\u003e 'value_2',\n], [\n    'id' =\u003e 1\n]);\n\n// will return affected_rows\n```\n\n\n## Get single value\n\n```php\n$value = $db-\u003egetValue(\"SELECT column_1 FROM test_table\");\n// or\n$value = $db-\u003egetValue(\"SELECT column_1 FROM test_table WHERE id = :id\", [ 'id' =\u003e 1 ]);\n```\n\n## Get pairs \n\n```php\n$pairs = $db-\u003egetPairs(\"SELECT id, column_1 FROM test_table\");\n\n// or\n\n$pairs = $db-\u003egetPairs(\"SELECT id, column_1 FROM test_table WHERE column_2 = :condition\", [ 'condition' =\u003e 'demo' ]);\n\n/*\nwill result\n$pairs = [\n     '1' =\u003e 'c1.1',\n     '2' =\u003e 'c2.1',\n     '3' =\u003e 'c3.1',\n];\n*/\n```\n\n## Get Custom query\n \n\n```php\n$query = $db-\u003equery(\"SELECT * FROM test_table\");\n\n// or\n\n$query = $db-\u003equery(\"SELECT * FROM test_table WHERE column = :condition\", [ 'condition' =\u003e 'demo' ]);\n\nwhile ($item = $query-\u003efetch(\\PDO::FETCH_ASSOC)) {\n    var_dump($item);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkisphp%2Fdbal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkisphp%2Fdbal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkisphp%2Fdbal/lists"}