2017 © Pedro Peláez
 

library titan-db

Simple and useful query builder for PHP.

image

tkaratug/titan-db

Simple and useful query builder for PHP.

  • Monday, May 8, 2017
  • by tkaratug
  • Repository
  • 1 Watchers
  • 4 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 2 Versions
  • 50 % Grown

The README.md

TitanDB

Simple query builder and PDO Class for PHP, (*1)

Total Downloads License, (*2)

Install

Run the following command directly., (*3)

$ composer require tkaratug/titan-db

Example

require 'vendor/autoload.php';

$config = [
    'db_driver'     => 'mysql',
    'db_host'       => 'localhost',
    'db_user'       => 'root',
    'db_pass'       => '',
    'db_name'       => 'test',
    'db_charset'    => 'utf8',
    'db_collation'  => 'utf8_general_ci',
    'db_prefix'     => ''
];

$db = TitanDB::init($config);

$records    = $db->select('user_id, first_name, last_name, email')
                 ->from('users')
                 ->where('active', 1)
                 ->order_by('user_id', 'asc')
                 ->get()
                 ->results();            
var_dump($records);

// Get all columns
$records    = $db->get('users')->results();
var_dump($records);

// Get all columns in a row
$db->where('user_id', 5);
$records    = $db->get('users')->row();
var_dump($records);

// JOIN Usage
$record     = $db->select('t1.user_id, t1.first_name, t1.last_name, t2.group_name')
                 ->from('users as t1')
                 ->join('groups as t2', 't1.user_id=t2.user_id', 'left')
                 ->where('t1.active', 1)
                 ->get()
                 ->results();
var_dump($record);

// INSERT Usage
$data = [
    'first_name'    => 'John',
    'last_name'     => 'Doe',
    'email'         => 'john@doe.com'
];

$db->insert('users', $data);

// UPDATE Usage
$data = [
    'first_name'    => 'John',
    'last_name'     => 'Doe',
    'email'         => 'john@doe.com'
];

$db->where('user_id', 5);
$db->update('users', $data);

// DELETE Usage
$db->where('user_id', 5);
$db->delete('users');

Licence

MIT Licence, (*4)

The Versions

08/05 2017

dev-master

9999999-dev https://github.com/tkaratug/TitanDB

Simple and useful query builder for PHP.

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql php query pdo mysql builder

23/03 2017

v1.0.1

1.0.1.0 https://github.com/tkaratug/TitanDB

Simple and useful query builder for PHP.

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql php query pdo mysql builder