{"id":21458762,"url":"https://github.com/robclancy/db-connector","last_synced_at":"2025-07-17T13:36:02.057Z","repository":{"id":7961213,"uuid":"9359000","full_name":"robclancy/db-connector","owner":"robclancy","description":"Fork of illuminate/database to provide a simple package for database connection alone","archived":false,"fork":false,"pushed_at":"2013-04-11T07:53:50.000Z","size":352,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T07:38:08.795Z","etag":null,"topics":[],"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/robclancy.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":"2013-04-11T00:31:15.000Z","updated_at":"2019-06-01T04:25:15.000Z","dependencies_parsed_at":"2022-09-22T14:41:20.547Z","dependency_job_id":null,"html_url":"https://github.com/robclancy/db-connector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robclancy%2Fdb-connector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robclancy%2Fdb-connector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robclancy%2Fdb-connector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robclancy%2Fdb-connector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robclancy","download_url":"https://codeload.github.com/robclancy/db-connector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243971180,"owners_count":20376784,"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":[],"created_at":"2024-11-23T06:24:02.468Z","updated_at":"2025-03-17T04:19:41.261Z","avatar_url":"https://github.com/robclancy.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Database Connector\n\nThis package is simply a fork of [http://github.com/illuminate/database](illuminate/database) to just provide the connectors.\n\n[![Build Status](https://secure.travis-ci.org/robclancy/db-connector.png)](http://travis-ci.org/robclancy/db-connector)\n\n## Installation\n\nAdd the following to the \"require\" section of your `composer.json` file:\n\n```json\n\t\"robclancy/db-connector\": \"1.0.x\"\n```\n\n## Basic Usage\n\nYou will need a config array, the following shows what can be used...\n\n```php\n$config = array(\n\n\t'fetch' =\u003e PDO::FETCH_CLASS,\n\n\t// SQLite\n\t'database' =\u003e __DIR__.'/../database/production.sqlite',\n\t'prefix'   =\u003e '',\n\n\t// MySQL\n\t'host'      =\u003e 'localhost',\n\t'database'  =\u003e 'database',\n\t'username'  =\u003e 'root',\n\t'password'  =\u003e '',\n\t'charset'   =\u003e 'utf8',\n\t'collation' =\u003e 'utf8_unicode_ci',\n\t'prefix'    =\u003e '',\n\n\t// Postgres SQL\n\t'host'     =\u003e 'localhost',\n\t'database' =\u003e 'database',\n\t'username' =\u003e 'root',\n\t'password' =\u003e '',\n\t'charset'  =\u003e 'utf8',\n\t'prefix'   =\u003e '',\n\t'schema'   =\u003e 'public',\n\n\t// SQL Server\n\t'driver'   =\u003e 'sqlsrv',\n\t'host'     =\u003e 'localhost',\n\t'database' =\u003e 'database',\n\t'username' =\u003e 'root',\n\t'password' =\u003e '',\n\t'prefix'   =\u003e '',\n);\n```\n\nAnd then to make your connection...\n\n```php\n\n$connector = new Robbo\\DbConnector\\MysqlConnector;\n\n$pdo = $connector-\u003econnect($config);\n```\n\nTo make things a little easier and more flexible for applications that support multiple database types you can use a factory method to connect.\nThe config stays the same however you add a driver as well. For example...\n\n```php\n\n$config = array(\n\t'driver' \t=\u003e 'mysql', // For other types this is 'pgsql', 'sqlite' or 'sqlsrv'\n\t\n\t'host'      =\u003e 'localhost',\n\t'database'  =\u003e 'database',\n\t'username'  =\u003e 'root',\n\t'password'  =\u003e '',\n\t'charset'   =\u003e 'utf8',\n\t'collation' =\u003e 'utf8_unicode_ci',\n\t'prefix'    =\u003e '',\n);\n```\n\nThen use the factor like so...\n\n```php\n \n$connector = Robbo\\DbConnector\\Connector::create($config); // Instance of Robbo/DbConnector/MySqlConnector\n$pdo = $connector-\u003econnect($config);\n\n// You can also have the factory connect for you by passing true as the second parameter, so...\n$pdo = Robbo\\DbConnector\\Connector::create($config, true);\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobclancy%2Fdb-connector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobclancy%2Fdb-connector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobclancy%2Fdb-connector/lists"}