PHPackages                             sqlgenix/sqlgenix - 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. sqlgenix/sqlgenix

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

sqlgenix/sqlgenix
=================

A PHP library that simplifies the construction of SQL queries for dynamic web applications.

v2.0.0(8mo ago)02[7 issues](https://github.com/Inkflow59/SQLGenix/issues)MITPHPPHP &gt;=7.1

Since Dec 13Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/Inkflow59/SQLGenix)[ Packagist](https://packagist.org/packages/sqlgenix/sqlgenix)[ RSS](/packages/sqlgenix-sqlgenix/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (4)Used By (0)

SQLGenix 🚀
==========

[](#sqlgenix-)

Supercharge Your Database Interactions
--------------------------------------

[](#supercharge-your-database-interactions)

SQLGenix is your go-to SQL query generator that takes the pain out of database operations. Say goodbye to manual SQL writing and hello to elegant, chainable methods that make database interactions a breeze. Perfect for both rapid application development and sophisticated database management tasks.

Table of Contents
-----------------

[](#table-of-contents)

- [Key Features](#key-features)
- [Quick Start](#quick-start)
    - [Installation](#installation)
    - [Usage Examples](#usage-examples)
        - [Create New Records](#create-new-records)
        - [Fetch Data](#fetch-data)
        - [Update Records](#update-records)
        - [Remove Data](#remove-data)
- [Requirements](#requirements)
- [Testing](#testing)
- [Contributing](#contributing)
- [License](#license)
- [Get in Touch](#get-in-touch)

✨ Key Features
--------------

[](#-key-features)

- 🎯 **Smart Query Generation** - Build complex SQL queries with simple, intuitive methods
- 🔄 **Full CRUD Support** - Handle SELECT, INSERT, UPDATE, and DELETE operations effortlessly
- 🔌 **Multi-Database Support** - Works seamlessly with MySQL, PostgreSQL, SQLite, and more
- 🛡️ **Robust Error Handling** - Graceful exception management keeps your application stable
- ⚡ **Lightning Fast** - Optimized for performance without sacrificing flexibility
- 📄 **Pagination Support** - Built-in LIMIT, OFFSET, and page-based pagination
- 🔄 **Query Caching** - Intelligent caching system for improved performance
- 🔗 **UNION Operations** - Combine multiple queries with UNION and UNION ALL
- 📦 **Bulk Operations** - Efficient batch INSERT, UPDATE, and DELETE operations
- 🔍 **Advanced Joins** - Support for INNER, LEFT, RIGHT joins with complex conditions
- 🏗️ **Database Adapters** - Adapter pattern for database-specific optimizations

🚀 Quick Start
-------------

[](#-quick-start)

### Installation

[](#installation)

Get started with Composer:

```
composer require sqlgenix/sqlgenix
```

Or clone the repository manually:

```
git clone https://github.com/Inkflow59/SQLGenix.git
cd SQLGenix
composer install
```

### 📚 Usage Examples

[](#-usage-examples)

#### Create New Records

[](#create-new-records)

```
require 'src/SQLInsert.php';

$db = new Database();
$insert = new SQLInsert($db);
$insert->into('users')
       ->set(['name', 'email'], ['John Doe', 'john@example.com'])
       ->execute();
```

#### Fetch Data

[](#fetch-data)

```
require 'src/SQLSelect.php';

$db = new Database();
$select = new SQLSelect($db);
$result = $select->select(['name', 'email'])
                 ->from('users')
                 ->where('email = "john@example.com"')
                 ->execute();
```

#### Update Records

[](#update-records)

```
require 'src/SQLUpdate.php';

$db = new Database();
$update = new SQLUpdate($db);
$update->table('users')
       ->set('name', 'Jane Doe')
       ->where('email = "john@example.com"')
       ->execute();
```

#### Remove Data

[](#remove-data)

```
require 'src/SQLDelete.php';

$db = new Database();
$delete = new SQLDelete($db);
$delete->from('users')
       ->where('email = "john@example.com"')
       ->execute();
```

#### Pagination

[](#pagination)

```
require 'src/SQLSelect.php';

$db = new Database();
$select = new SQLSelect($db);
$result = $select->select(['*'])
                 ->from('users')
                 ->where('status = "active"')
                 ->orderBy(['created_at'], 'DESC')
                 ->paginate(2, 20) // Page 2, 20 per page
                 ->execute();
```

#### Query Caching

[](#query-caching)

```
require 'src/QueryCache.php';
require 'src/SQLSelect.php';

$cache = new QueryCache(100, 3600); // 100 items, 1 hour TTL
$db = new Database();
$select = new SQLSelect($db, $cache);
$result = $select->select(['*'])
                 ->from('users')
                 ->where('active = 1')
                 ->execute(); // Cached automatically
```

#### UNION Operations

[](#union-operations)

```
require 'src/SQLSelect.php';

$db = new Database();
$activeUsers = new SQLSelect($db);
$activeUsers->select(['name', 'email'])->from('active_users');

$inactiveUsers = new SQLSelect($db);
$inactiveUsers->select(['name', 'email'])->from('inactive_users');

$allUsers = new SQLSelect($db);
$result = $allUsers->select(['name', 'email'])
                  ->from('current_users')
                  ->union($activeUsers)
                  ->unionAll($inactiveUsers)
                  ->execute();
```

#### Bulk Operations

[](#bulk-operations)

```
require 'src/BulkOperations.php';

$db = new Database();
$bulk = new BulkOperations($db);

// Bulk insert 1000 records
$data = []; // Your data array
$result = $bulk->bulkInsert('users', ['name', 'email'], $data);
echo "Inserted: " . $result['inserted_rows'] . " rows";
```

#### Multi-Database Support

[](#multi-database-support)

```
require 'src/DatabaseAdapterFactory.php';
require 'src/UniversalSQLSelect.php';

// Create MySQL adapter
$mysqlAdapter = DatabaseAdapterFactory::createMySQL([
    'host' => 'localhost',
    'database' => 'myapp',
    'username' => 'user',
    'password' => 'pass'
]);

// Create PostgreSQL adapter
$postgresAdapter = DatabaseAdapterFactory::createPostgreSQL([
    'host' => 'localhost',
    'database' => 'myapp',
    'username' => 'user',
    'password' => 'pass'
]);

// Same query works on both databases
$mysqlQuery = new UniversalSQLSelect($mysqlAdapter);
$postgresQuery = new UniversalSQLSelect($postgresAdapter);

$result = $mysqlQuery->select(['*'])->from('users')->execute();
```

⚙️ Requirements
---------------

[](#️-requirements)

- PHP 7.0+
- Any major SQL database (MySQL, PostgreSQL, SQLite)
- Composer for dependency management

🧪 Testing
---------

[](#-testing)

Run the test suite with:

```
composer test
```

🤝 Contributing
--------------

[](#-contributing)

We love contributions! Here's how you can help:

1. Fork the repo
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

📄 License
---------

[](#-license)

SQLGenix is MIT licensed. See the [LICENSE](LICENSE) file for details.

📬 Get in Touch
--------------

[](#-get-in-touch)

Questions or suggestions? [Drop me a line](mailto:tomcucherosset@hotmail.fr)

---

Made with ❤️ by SQLGenix Team

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance61

Regular maintenance activity

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~137 days

Total

3

Last Release

245d ago

Major Versions

v1.2.0 → v2.0.02025-09-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/d3f6f6217cdabc273515f4c76733fdeccf5835d678c024c0361e8ac6f6ac96c1?d=identicon)[Inkflow](/maintainers/Inkflow)

---

Top Contributors

[![Inkflow59](https://avatars.githubusercontent.com/u/101215221?v=4)](https://github.com/Inkflow59 "Inkflow59 (33 commits)")

---

Tags

composerphp-libraryphp8sql

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sqlgenix-sqlgenix/health.svg)

```
[![Health](https://phpackages.com/badges/sqlgenix-sqlgenix/health.svg)](https://phpackages.com/packages/sqlgenix-sqlgenix)
```

###  Alternatives

[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58723.9M36](/packages/scienta-doctrine-json-functions)[martin-georgiev/postgresql-for-doctrine

Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostGIS geometries, text search, ltree, uuid, and 100+ PostgreSQL-specific functions.

4485.3M4](/packages/martin-georgiev-postgresql-for-doctrine)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[worksome/foggy

Foggy is a tool for making database dumps with some data removed/changed.

26571.7k1](/packages/worksome-foggy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
