Skip to content

QueryBuilder is a user friendly php class for build MySql queries that prevents mysql injections and it takes care of table prefixing. This same can also support replication master and slave.

License

Notifications You must be signed in to change notification settings

adumitru68/QueryBuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QueryBuilder v2

QueryBuilder is a user friendly php class for build MySql queries that prevents mysql injections and it takes care of table prefixing. This same can also replication support for use master and slave.

Scrutinizer Code Quality Build Status

Old versions documentation

Requirements

  • Php 5.6+
  • Enable PDO (php.ini)
  • MySql 5.5 / 5.6 / 5.7 / MariaDB
  • Partial tested for MySql 8

Installation

composer require qpdb/query-builder

Configuration

It is enough to configure the pdoWrapper dependence.

How do we use?

include_once 'path/to/vendor/autoload.php';

use Qpdb\QueryBuilder\QueryBuild;

$query = QueryBuild::select( 'employees' )
	->fields('lastName, jobTitle, officeCode')
	->whereEqual( 'jobTitle', "Sales Rep" )
	->whereIn( 'officeCode', [ 2, 3, 4 ] );
	
$query->execute() /** return array */
	
Array
(
    [0] => Array
        (
            [lastName] => Firrelli
            [jobTitle] => Sales Rep
            [officeCode] => 2
        )

    [1] => Array
        (
            [lastName] => Patterson
            [jobTitle] => Sales Rep
            [officeCode] => 2
        )
    ...
)

About

QueryBuilder is a user friendly php class for build MySql queries that prevents mysql injections and it takes care of table prefixing. This same can also support replication master and slave.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages