Skip to content

Instantly share code, notes, and snippets.

@dennisdegryse
Created June 16, 2015 18:32
Show Gist options
  • Save dennisdegryse/a0bac4dec64d75c4c8f2 to your computer and use it in GitHub Desktop.
Save dennisdegryse/a0bac4dec64d75c4c8f2 to your computer and use it in GitHub Desktop.
<?php
class PDOFactory {
private $dsn;
private $username;
private $password;
private $options;
public PDOFactory($dsn, $username, $password, $options = []) {
$this->dsn = $dsn;
$this->username = $username;
$this->password = $password;
$this->options = $options;
}
public function createInstance() {
return new PDO($this->dsn, $this->username, $this->password, $this->options);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment