Squibble PHP SQL Library

Squibble is an easy to use PHP SQL library for accelerating development.

Supported Databases

PostgreSQL, MySQL (coming soon), MariaDB (coming soon)

Basic Usage


require_once('/path/to/vendor/autoload.php');

// Database connection settings
$connection = [
	'type' 		=> 'PgSQL',
	'host' 		=> 'your.sql.host',
	'port' 		=> 5432,
	'dbname' 	=> 'your.database.name',
	'user' 		=> 'your.username',
	'password' 	=> 'your.password',
];

// Create a new instance of Squibble with your connection settings
$squibble = new \Dorsataio\Squibble\Squibble($connection);

// This is a simple SELECT example
try{
	// Selecting a user with a specific email address
	$s = $squibble->select('users', [
		'id',
		'first_name',
		'last_name',
		'email_address'
	])->where([
		'email_address[=]' => 'vofeeneyg@fda.gov',
	]);
	// collect() return an array of the result sets. This is the
	// same as PDO $query->fetchAll(PDO::FETCH_ASSOC)
	$user = $s->collect();
}catch(PDOException $e){
	echo "Error, {$e->getCode()}, {$e->getMessage()}";
}catch(Exception $e){
	echo "Error, {$e->getCode()}, {$e->getMessage()}";
}

Sample Output


array (
  0 => 
  array (
    'id' => 18,
    'first_name' => 'Vonnie',
    'last_name' => 'O\'Feeney',
    'email_address' => 'vofeeneyg@fda.gov',
  ),
)



Share on facebook
Facebook
Share on google
Google+
Share on twitter
Twitter
Share on linkedin
LinkedIn