PHPackages                             robclancy/db-connector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. robclancy/db-connector

ActiveLibrary

robclancy/db-connector
======================

Fork of illuminate/database to provide a simple package for database connection alone

11281PHP

Since Apr 11Pushed 13y ago1 watchersCompare

[ Source](https://github.com/robclancy/db-connector)[ Packagist](https://packagist.org/packages/robclancy/db-connector)[ RSS](/packages/robclancy-db-connector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Database Connector
======================

[](#php-database-connector)

This package is simply a fork of [http://github.com/illuminate/database](illuminate/database) to just provide the connectors.

[![Build Status](https://camo.githubusercontent.com/a728161d2d5f44dd797ca7f4c0fe4b939eb8aea0137eee9ed2a138cd5fa4c73d/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f726f62636c616e63792f64622d636f6e6e6563746f722e706e67)](http://travis-ci.org/robclancy/db-connector)

Installation
------------

[](#installation)

Add the following to the "require" section of your `composer.json` file:

```
	"robclancy/db-connector": "1.0.x"
```

Basic Usage
-----------

[](#basic-usage)

You will need a config array, the following shows what can be used...

```
$config = array(

	'fetch' => PDO::FETCH_CLASS,

	// SQLite
	'database' => __DIR__.'/../database/production.sqlite',
	'prefix'   => '',

	// MySQL
	'host'      => 'localhost',
	'database'  => 'database',
	'username'  => 'root',
	'password'  => '',
	'charset'   => 'utf8',
	'collation' => 'utf8_unicode_ci',
	'prefix'    => '',

	// Postgres SQL
	'host'     => 'localhost',
	'database' => 'database',
	'username' => 'root',
	'password' => '',
	'charset'  => 'utf8',
	'prefix'   => '',
	'schema'   => 'public',

	// SQL Server
	'driver'   => 'sqlsrv',
	'host'     => 'localhost',
	'database' => 'database',
	'username' => 'root',
	'password' => '',
	'prefix'   => '',
);
```

And then to make your connection...

```
$connector = new Robbo\DbConnector\MysqlConnector;

$pdo = $connector->connect($config);
```

To make things a little easier and more flexible for applications that support multiple database types you can use a factory method to connect. The config stays the same however you add a driver as well. For example...

```
$config = array(
	'driver' 	=> 'mysql', // For other types this is 'pgsql', 'sqlite' or 'sqlsrv'

	'host'      => 'localhost',
	'database'  => 'database',
	'username'  => 'root',
	'password'  => '',
	'charset'   => 'utf8',
	'collation' => 'utf8_unicode_ci',
	'prefix'    => '',
);
```

Then use the factor like so...

```

$connector = Robbo\DbConnector\Connector::create($config); // Instance of Robbo/DbConnector/MySqlConnector
$pdo = $connector->connect($config);

// You can also have the factory connect for you by passing true as the second parameter, so...
$pdo = Robbo\DbConnector\Connector::create($config, true);
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ac33556a611a70332996beca9c9eb795f85368b32dd49bec5c49bf5181c37e93?d=identicon)[Robbo](/maintainers/Robbo)

---

Top Contributors

[![taylorotwell](https://avatars.githubusercontent.com/u/463230?v=4)](https://github.com/taylorotwell "taylorotwell (162 commits)")[![bencorlett](https://avatars.githubusercontent.com/u/181919?v=4)](https://github.com/bencorlett "bencorlett (6 commits)")[![robclancy-test](https://avatars.githubusercontent.com/u/123053691?v=4)](https://github.com/robclancy-test "robclancy-test (6 commits)")[![navruzm](https://avatars.githubusercontent.com/u/168341?v=4)](https://github.com/navruzm "navruzm (5 commits)")[![joecwallace](https://avatars.githubusercontent.com/u/925701?v=4)](https://github.com/joecwallace "joecwallace (4 commits)")[![tgriesser](https://avatars.githubusercontent.com/u/154748?v=4)](https://github.com/tgriesser "tgriesser (2 commits)")[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (2 commits)")[![nckg](https://avatars.githubusercontent.com/u/360602?v=4)](https://github.com/nckg "nckg (2 commits)")[![driesvints](https://avatars.githubusercontent.com/u/594614?v=4)](https://github.com/driesvints "driesvints (2 commits)")[![conradkleinespel](https://avatars.githubusercontent.com/u/1234006?v=4)](https://github.com/conradkleinespel "conradkleinespel (2 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (1 commits)")[![rmobis](https://avatars.githubusercontent.com/u/2119933?v=4)](https://github.com/rmobis "rmobis (1 commits)")[![kapv89](https://avatars.githubusercontent.com/u/1023032?v=4)](https://github.com/kapv89 "kapv89 (1 commits)")[![danielboendergaard](https://avatars.githubusercontent.com/u/314877?v=4)](https://github.com/danielboendergaard "danielboendergaard (1 commits)")[![franzliedke](https://avatars.githubusercontent.com/u/249125?v=4)](https://github.com/franzliedke "franzliedke (1 commits)")[![HellPat](https://avatars.githubusercontent.com/u/1016798?v=4)](https://github.com/HellPat "HellPat (1 commits)")[![JonoB](https://avatars.githubusercontent.com/u/627725?v=4)](https://github.com/JonoB "JonoB (1 commits)")[![JoostK](https://avatars.githubusercontent.com/u/123679?v=4)](https://github.com/JoostK "JoostK (1 commits)")[![ackerdev](https://avatars.githubusercontent.com/u/2708892?v=4)](https://github.com/ackerdev "ackerdev (1 commits)")[![karptonite](https://avatars.githubusercontent.com/u/132278?v=4)](https://github.com/karptonite "karptonite (1 commits)")

### Embed Badge

![Health badge](/badges/robclancy-db-connector/health.svg)

```
[![Health](https://phpackages.com/badges/robclancy-db-connector/health.svg)](https://phpackages.com/packages/robclancy-db-connector)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
