https://github.com/adumitru68/querybuilder
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.
https://github.com/adumitru68/querybuilder
mysql pdo php5 query-builder
Last synced: about 2 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/adumitru68/querybuilder
- Owner: adumitru68
- License: mit
- Created: 2017-07-15T06:50:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-12-02T22:41:19.000Z (over 5 years ago)
- Last Synced: 2025-01-19T21:48:40.271Z (3 months ago)
- Topics: mysql, pdo, php5, query-builder
- Language: PHP
- Homepage:
- Size: 183 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
[](https://scrutinizer-ci.com/g/adumitru68/QueryBuilder/?branch=master)
[](https://scrutinizer-ci.com/g/adumitru68/QueryBuilder/build-status/master)[Old versions documentation](docs/v1_config.md)
### 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](https://github.com/adumitru68/PdoWrapper/blob/master/README.md) dependence.
### How do we use?
```php
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
)
...
)
```