2017 © Pedro Peláez
 

library db

Another PDO wrapper

image

tabusoft/db

Another PDO wrapper

  • Thursday, July 19, 2018
  • by alveoten
  • Repository
  • 1 Watchers
  • 1 Stars
  • 8 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Tabusoft/DB

Tabusoft/DB is another DB wrapper to PDO/MySQL., (*1)

  • It's simple like PDO
  • Simplify the use of array values
  • Configurable with factory class and configuration

Installation

You can install it with composer, (*2)

$ composer require tabusoft/db

Use

Direct instance of DB.

You can directly pass an array to query to bind ? parameters., (*3)

<?php
$db = new \Tabusoft\DB\DB("localhost", 'db-name', 'username', 'password');
$qres = $db->query("SELECT *
                        FROM table 
                        WHERE c1 = ? 
                            OR c2 IN (?) 
                            OR c3 = ?", 
                    [
                        1, //c1
                        [3,4,5], //c2 parameter extends the placeholder as array
                        1 //c3
                    ] );

echo PHP_EOL."Found: ".$qres->rowCount().PHP_EOL;

foreach($qres as $r){
    dump($r);
}

Use with the factory class

<?php 
$config = new \Tabusoft\DB\DBFactoryConfig("localhost", 'db-name', 'username', 'password');

$db = \Tabusoft\DB\DBFactory::getInstance($config);

Query events

You can add query events. Pre and Post execution:, (*4)


class Event implements \Tabusoft\DB\DBEventsQueryInterface { public function __invoke(DB $db, $sql, array $infos) { dump($infos); } } $db = \Tabusoft\DB\DBFactory::getInstance($config); $db->addEvent(new Event(), DB::EVENT_PRE_QUERY); $db->addEvent(new Event(), DB::EVENT_POST_QUERY);

The Versions

19/07 2018

dev-master

9999999-dev

Another PDO wrapper

  Sources   Download

GPL-3.0+

The Development Requires

by Marco Tabucchi

19/07 2018

1.0.5

1.0.5.0

Another PDO wrapper

  Sources   Download

GPL-3.0+

The Development Requires

by Marco Tabucchi

18/07 2018

1.0.4

1.0.4.0

Another PDO wrapper

  Sources   Download

GPL-3.0+

The Development Requires

by Marco Tabucchi

18/07 2018

1.0.3

1.0.3.0

Another PDO wrapper

  Sources   Download

GPL-3.0+

The Development Requires

by Marco Tabucchi

18/07 2018

1.0.2

1.0.2.0

Another PDO wrapper

  Sources   Download

GPL-3.0+

The Development Requires

by Marco Tabucchi

29/06 2018

1.0.1

1.0.1.0

Another PDO wrapper

  Sources   Download

GPL-3.0+

The Development Requires

by Marco Tabucchi

29/06 2018

1.0.0

1.0.0.0

Another PDO wrapper

  Sources   Download

GPL v3

The Development Requires

by Marco Tabucchi