PHPackages                             shredio/rapid-database-operations - 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. shredio/rapid-database-operations

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

shredio/rapid-database-operations
=================================

1.3.7(3w ago)04521MITPHPPHP &gt;=8.3CI failing

Since Jun 5Pushed 3w ago1 watchersCompare

[ Source](https://github.com/Shredio/rapid-database-operations)[ Packagist](https://packagist.org/packages/shredio/rapid-database-operations)[ RSS](/packages/shredio-rapid-database-operations/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (24)Versions (24)Used By (1)

Rapid Database Operations
=========================

[](#rapid-database-operations)

A PHP library for high-performance database operations with Doctrine ORM support.

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

[](#installation)

```
composer require shredio/rapid-database-operations
```

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

[](#requirements)

- PHP 8.3 or higher
- Doctrine ORM 3.0+ (optional, for Doctrine integration)
- Doctrine DBAL 4.0+ (optional, for Doctrine integration)

Features
--------

[](#features)

- **High-performance database operations** - Optimized bulk insert and update operations
- **Doctrine ORM integration** - Seamless integration with Doctrine entities
- **Multiple database platforms** - Support for MySQL and SQLite
- **Type-safe operations** - Generic templates for type safety
- **Symfony Bundle** - Easy integration with Symfony applications
- **Flexible escaping** - Customizable value escaping strategies

Basic Usage
-----------

[](#basic-usage)

### Using RapidOperationFactory

[](#using-rapidoperationfactory)

The `RapidOperationFactory` is the main entry point for creating database operations:

```
use Shredio\RapidDatabaseOperations\Doctrine\DoctrineRapidOperationFactory;

$factory = new DoctrineRapidOperationFactory($entityManager);
```

### Insert Operations

[](#insert-operations)

```
// Basic insert - fails on duplicate keys
$inserter = $factory->createInsert(Article::class);
$inserter->addRaw([
    'id' => 1,
    'title' => 'Article Title',
    'content' => 'Article content...'
]);
$inserter->execute();

// Unique insert - silently ignores duplicates
$uniqueInserter = $factory->createUniqueInsert(Article::class);
$uniqueInserter->addRaw([
    'id' => 1,
    'title' => 'This will be ignored if ID 1 exists'
]);
$uniqueInserter->execute();

// Upsert - insert or update on conflict
$upserter = $factory->createUpsert(Article::class, ['title', 'content']);
$upserter->addRaw([
    'id' => 1,
    'title' => 'Updated Title',
    'content' => 'Updated content...'
]);
$upserter->execute();
```

### Update Operations

[](#update-operations)

```
// Standard update for smaller datasets
$updater = $factory->createUpdate(Article::class, ['id']);
$updater->addRaw([
    'id' => 1,
    'title' => 'Updated Title',
    'updated_at' => new DateTime()
]);
$updater->execute();

// Big update for large datasets - uses temporary tables
$bigUpdater = $factory->createBigUpdate(Article::class, ['id']);
// Add thousands of records...
$bigUpdater->execute();
```

### Direct Usage (Alternative)

[](#direct-usage-alternative)

You can also create operations directly:

```
use Shredio\RapidDatabaseOperations\Doctrine\DoctrineRapidInserter;
use Shredio\RapidDatabaseOperations\Doctrine\DoctrineRapidUpdater;

// Direct inserter creation
$inserter = new DoctrineRapidInserter(Article::class, $entityManager);
$inserter->addRaw(['id' => 1, 'title' => 'Title']);
$inserter->execute();

// Direct updater creation
$updater = new DoctrineRapidUpdater(Article::class, $entityManager);
$updater->addRaw(['id' => 1, 'title' => 'Updated Title']);
$updater->execute();
```

Operation Types
---------------

[](#operation-types)

### createInsert(string $entity)

[](#createinsertstring-entity)

Creates a basic insert operation that will fail if duplicate keys are encountered.

### createUniqueInsert(string $entity)

[](#createuniqueinsertstring-entity)

Creates an insert operation that silently ignores duplicate records using `INSERT ... ON DUPLICATE KEY ... DO NOTHING`.

### createUpsert(string $entity, array $fieldsToUpdate = \[\])

[](#createupsertstring-entity-array-fieldstoupdate--)

Creates an upsert operation that inserts new records or updates existing ones on conflict. You can specify which fields to update, or leave empty to update all fields.

### createUpdate(string $entity, array $conditions)

[](#createupdatestring-entity-array-conditions)

Creates a standard update operation using direct `UPDATE` statements. Best for smaller datasets.

### createBigUpdate(string $entity, array $conditions)

[](#createbigupdatestring-entity-array-conditions)

Creates an optimized update operation that uses temporary tables for better performance with large datasets.

### Symfony Integration

[](#symfony-integration)

The library includes a Symfony bundle for easy integration:

```
// config/bundles.php
return [
    // ...
    Shredio\RapidDatabaseOperations\Symfony\RapidDatabaseOperationsBundle::class => ['all' => true],
];
```

Development
-----------

[](#development)

### Running Tests

[](#running-tests)

```
composer test
```

### Static Analysis

[](#static-analysis)

```
composer phpstan
```

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance94

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~16 days

Recently: every ~35 days

Total

23

Last Release

26d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/312e788a47a251e05734378921d4596a91819b7de416fa18e77aa69e08798ea8?d=identicon)[Antik](/maintainers/Antik)

---

Top Contributors

[![MartkCz](https://avatars.githubusercontent.com/u/10145362?v=4)](https://github.com/MartkCz "MartkCz (42 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/shredio-rapid-database-operations/health.svg)

```
[![Health](https://phpackages.com/badges/shredio-rapid-database-operations/health.svg)](https://phpackages.com/packages/shredio-rapid-database-operations)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[yemenopensource/filament-excel

This package useful for importing excel files into models.

194.2k](/packages/yemenopensource-filament-excel)

PHPackages © 2026

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