{"id":13699719,"url":"https://github.com/swoole/ext-postgresql","last_synced_at":"2025-05-04T16:35:48.742Z","repository":{"id":36906710,"uuid":"181596328","full_name":"swoole/ext-postgresql","owner":"swoole","description":"🐘 Coroutine-based client for PostgreSQL","archived":true,"fork":false,"pushed_at":"2022-09-28T00:32:29.000Z","size":120,"stargazers_count":65,"open_issues_count":13,"forks_count":21,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-11-13T05:36:07.685Z","etag":null,"topics":["coroutine","postgresql","swoole"],"latest_commit_sha":null,"homepage":"","language":"C++","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/swoole.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":"2019-04-16T02:05:06.000Z","updated_at":"2024-09-15T19:14:45.000Z","dependencies_parsed_at":"2023-01-17T07:07:42.962Z","dependency_job_id":null,"html_url":"https://github.com/swoole/ext-postgresql","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swoole%2Fext-postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swoole%2Fext-postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swoole%2Fext-postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swoole%2Fext-postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swoole","download_url":"https://codeload.github.com/swoole/ext-postgresql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252367033,"owners_count":21736686,"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","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":["coroutine","postgresql","swoole"],"created_at":"2024-08-02T20:00:42.395Z","updated_at":"2025-05-04T16:35:48.449Z","avatar_url":"https://github.com/swoole.png","language":"C++","funding_links":[],"categories":["Client Packages"],"sub_categories":[],"readme":"# Swoole Coroutine Postgres Client\n\n`ext-postgresql` is the Swoole Postgres Client library can be used with in the coroutine context without blocking.\n\n### Pre-requirement\n\n* `libpq` is required\n* `swoole` version \u003e= 4.4.0\n\n### Build \u0026 Installation\n\n```bash\ngit clone git@github.com:swoole/ext-postgresql.git\nphpize\n./configure\nmake \u0026\u0026 make install\n```\n\nEnable `swoole_postgresql` in php.ini by adding the following line:\n```\nextension=swoole_postgresql.so\n```\n\n### How to use the Postgres Client\n\n```php\n\u003c?php\nCo\\run(function () {\n    $db = new Swoole\\Coroutine\\PostgreSQL();\n    $db-\u003econnect(\"host=127.0.0.1 port=5432 dbname=test user=root password=password\");\n    $db-\u003eprepare('fortunes', 'SELECT id, message FROM Fortune');\n    $res = $db-\u003eexecute('fortunes', []);\n    $arr = $db-\u003efetchAll($res);\n    var_dump($arr);\n\n    $db-\u003eprepare('select_query', 'SELECT id, randomnumber FROM World WHERE id = $1');\n    $res = $db-\u003eexecute('select_query', [123]);\n    $ret = $db-\u003efetchAll($res);\n    var_dump($ret);\n});\n```\n\nYou can find more examples in the `/examples` folder.\n \n \n\n  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswoole%2Fext-postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswoole%2Fext-postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswoole%2Fext-postgresql/lists"}