{"id":18273231,"url":"https://github.com/spacetab-io/db-config-php","last_synced_at":"2026-02-27T19:08:09.367Z","repository":{"id":57056366,"uuid":"261423286","full_name":"spacetab-io/db-config-php","owner":"spacetab-io","description":"Creates a DSN string from an array. Supports Connection URI's and Connection Key-Value strings.","archived":false,"fork":false,"pushed_at":"2020-05-05T11:03:10.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-27T16:34:11.594Z","etag":null,"topics":["amphp","connection-string","db","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spacetab-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-05T10:17:19.000Z","updated_at":"2025-03-05T20:13:06.000Z","dependencies_parsed_at":"2022-08-24T07:30:29.758Z","dependency_job_id":null,"html_url":"https://github.com/spacetab-io/db-config-php","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/spacetab-io/db-config-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fdb-config-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fdb-config-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fdb-config-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fdb-config-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacetab-io","download_url":"https://codeload.github.com/spacetab-io/db-config-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fdb-config-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29909302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T17:28:36.873Z","status":"ssl_error","status_checked_at":"2026-02-27T17:28:20.970Z","response_time":57,"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":["amphp","connection-string","db","php"],"created_at":"2024-11-05T12:05:43.136Z","updated_at":"2026-02-27T19:08:09.349Z","avatar_url":"https://github.com/spacetab-io.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"DB Config \n=========\n\n[![CircleCI](https://circleci.com/gh/spacetab-io/db-config-php/tree/master.svg?style=svg)](https://circleci.com/gh/spacetab-io/db-config-php/tree/master)\n[![codecov](https://codecov.io/gh/spacetab-io/db-config-php/branch/master/graph/badge.svg)](https://codecov.io/gh/spacetab-io/db-config-php)\n\nCreates a DSN string from an array. Supports Connection URI's and Connection Key-Value strings.\n\n## Installation\n\n```bash\ncomposer require spacetab-io/db-config\n```\n\n## Spec\n\n```yaml\ndb:\n  default: # \u003c-- connection name\n    type: pgsql\n    name: string\n    host: string|array\n    port: int|array\n    pass: string\n    schema: string\n    options: array\u003cstring, mixed\u003e\n  mysql: # \u003c-- connection name\n    type: mysql\n    name: string\n    host: string|array\n    port: int|array\n    pass: string\n    options: array\u003cstring, mixed\u003e \n```\n\nNote: all parameters are optional. By default, used `default` connection and `pgsql` database type (`postgres@127.0.0.1:5432/postgres`). \n\n## Sample\n\n```php\n\u003c?php\n\nuse Spacetab\\DbConfig\\Packer\\KeyValue;\nuse Spacetab\\DbConfig\\Reader;\n\n$config = new Reader([\n    'default' =\u003e [\n        'type' =\u003e 'pgsql',\n        'name' =\u003e 'roquie',\n        'host' =\u003e ['127.0.0.1', '127.0.0.2'],\n        'port' =\u003e [5432, 6432],\n        'user' =\u003e 'roquie',\n        'pass' =\u003e 'secret',\n        'schema' =\u003e 'public',\n        'options' =\u003e [\n            'connect_timeout' =\u003e 10,\n            'target_session_attrs' =\u003e 'any',\n            'sslmode' =\u003e 'require',\n        ],\n    ]\n]);\n\n$config-\u003eaddPacker('pgsql', new KeyValue\\Postgres());\n$config-\u003egetConnectionString($connectionName = 'default'); \n# host=127.0.0.1,127.0.0.2 port=5432,6432 user=roquie password=secret dbname=roquie schema=roquie connect_timeout=10 target_session_attrs=any sslmode=require\n```\n\nNote: Amphp connection string to mysql and postgres clients does not support multiple hosts connection (05-05-2020).\n\n## Depends\n\n* \\\u003e= PHP 7.4\n* Composer for install package\n\n## License\n\nThe MIT License\n\nCopyright © 2020 spacetab.io, Inc. https://spacetab.io\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacetab-io%2Fdb-config-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacetab-io%2Fdb-config-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacetab-io%2Fdb-config-php/lists"}