PHPackages                             buildql/query-builder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. buildql/query-builder

ActiveLibrary[Database &amp; ORM](/categories/database)

buildql/query-builder
=====================

A secure, fluent, and lightweight SQL Query Builder for PHP, inspired by Laravel Query Builder.

v1.0.4(3mo ago)118MITPHPPHP &gt;=8.0

Since Oct 3Pushed 3mo agoCompare

[ Source](https://github.com/buildQL/query-builder)[ Packagist](https://packagist.org/packages/buildql/query-builder)[ RSS](/packages/buildql-query-builder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (6)Used By (0)

BuildQL Query Builder
=====================

[](#buildql-query-builder)

A secure, fluent, and lightweight SQL Query Builder for PHP 8.0+, inspired by Laravel's Query Builder. BuildQL provides an expressive and intuitive API for building complex database queries without writing raw SQL.

[![PHP Version](https://camo.githubusercontent.com/2f6f9af2e917cbf5786673e8e4ed8d0d9b29be6131327a992063e69136a93411/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302532422d626c7565)](https://php.net)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)

🎉 What's New in v1.0.4
----------------------

[](#-whats-new-in-v104)

- **New `exists()` method**: Quickly check if records exist without fetching data ← ADD
- **Strict Type Comparison**: All comparison operators now use `===` for type-safe queries
- **Improved Reliability**: Enhanced type safety prevents unexpected query results
- **Better Performance**: More predictable query execution

[View full changelog](CHANGELOG.md)

---

Features
--------

[](#features)

- **Fluent Interface**: Chain methods to build complex queries elegantly
- **Security First**: Built-in protection against SQL injection using prepared statements
- **Laravel-Style Syntax**: Familiar API for developers coming from Laravel
- **Multiple Join Types**: Support for INNER, LEFT, RIGHT, and CROSS joins
- **Aggregate Functions**: Built-in support for COUNT, SUM, MIN, MAX, AVG
- **Advanced Filtering**: WHERE, OR WHERE, WHERE IN, WHERE NULL, WHERE NOT NULL conditions
- **Query Builder**: GROUP BY, HAVING, ORDER BY, LIMIT, OFFSET support
- **Raw SQL Support**: Execute custom queries when needed
- **Environment Configuration**: Optional .env file support via phpdotenv
- **Comprehensive Testing**: Fully tested with Pest PHP
- **Type-Safe Comparisons**: Strict comparison operators (v1.0.4+) ← ADD THIS
- **Existence Checks**: Quick `exists()` method to check record presence (v1.0.4+) ← ADD

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- MySQLi extension
- MySQL/MariaDB database

Installation
------------

[](#installation)

Install via Composer:

```
composer require buildql/query-builder
```

Quick Start
-----------

[](#quick-start)

### Basic Configuration

[](#basic-configuration)

```
