Download the PHP package aeatech/transaction-manager-doctrine-adapter without Composer

On this page you can find all versions of the php package aeatech/transaction-manager-doctrine-adapter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package transaction-manager-doctrine-adapter

AEATech Transaction Manager — Doctrine Adapter

Doctrine DBAL adapter for AEATech Transaction Manager with best‑effort prepared‑statement reuse and explicit parameter binding compatible with both DBAL 3 and DBAL 4.

Key Features

Contents (API Surface)

Installation

Quick Start

Statement Reuse Policies

Statement Cache

LRU Cache

LruStatementCache provides O(1) get/set and evicts the least‑recently used entry when capacity is exceeded.

Implementation notes:

Cache Key Builder

SqlAndParamCountCacheKeyBuilder builds keys as sha256(sql) | 'p:' . count(params).

Implications:

StatementExecutor (explicit binding)

StatementExecutor executes an already prepared DBAL Statement and performs explicit parameter binding using the wrapped driver statement. This bypasses DBAL’s internal binding logic and supports a broader set of type descriptors for compatibility across DBAL versions.

Supported type descriptors for each parameter:

Binding rules:

Compatibility notes:

Transaction Adapters

MySQL/MariaDB

DbalMysqlStatementCachingConnectionAdapter::beginTransactionWithOptions() sets the isolation level for the next transaction (if provided in $options) and then begins the transaction:

PostgreSQL

DbalPostgresStatementCachingConnectionAdapter::beginTransactionWithOptions() begins a transaction first and then sets isolation for the current transaction only (if provided in $options):

Both adapters:

Edge Cases and Limitations

Examples

Positional parameters with mixed types

Named parameters with explicit DBAL types

Using PDO type constants

Choosing the Right Adapter

Selecting the appropriate adapter depends on your database, prepared statement mode, and performance characteristics of your workload.

Adapter Selection Matrix

Database Mode Recommended Adapter Why?
MySQL Server-side Prepares DbalMysqlStatementCachingConnectionAdapter Significant performance gain. avoids repeated COM_STMT_PREPARE round-trips and server-side parsing.
MySQL Emulated Prepares DbalMysqlConnectionAdapter Simpler and sufficient. PDO client-side emulation is already efficient; statement caching provides no measurable benefit.
PostgreSQL Native DbalPostgresConnectionAdapter Recommended default. pdo_pgsql preparation overhead is low; client-side caching yields only marginal gains in typical workloads.
PostgreSQL Complex/Heavy load DbalPostgresStatementCachingConnectionAdapter Optional optimization. May reduce allocation and preparation overhead under extreme load or highly repetitive statement execution.

Recommendations

  1. Use Caching Adapters for MySQL Server-Side Prepares: If you have PDO::ATTR_EMULATE_PREPARES => false, prefer DbalMysqlStatementCachingConnectionAdapter. Reusing prepared statements avoids repeated server-side prepares and can result in 2× or greater throughput improvements for statement-heavy workloads.
  2. MySQL with Emulated Prepared Statements: When using client-side emulation, DbalMysqlConnectionAdapter is the preferred choice. It is lighter, simpler to configure, and provides identical performance without maintaining an internal statement cache.
  3. PostgreSQL Default Usage: Start with DbalPostgresConnectionAdapter. PostgreSQL already handles prepared statements efficiently via the extended query protocol ,and statement caching typically provides only 1–3% improvements in microbenchmarks.
  4. Memory-Constrained Environments: When memory usage is critical, prefer non-caching adapters. They avoid maintaining internal LRU caches and provide more predictable memory behavior.

For detailed performance measurements and the rationale behind these recommendations, see the Benchmarking section.

Benchmarking

The package includes a benchmark suite to measure the effectiveness of prepared statement reuse across different databases and configurations.

Running Benchmarks

A dedicated script bench.sh is provided to run benchmarks in a controlled environment with CPU pinning to reduce noise.

The script performs the following actions:

  1. Starts Docker containers for PHP, MySQL, and PostgreSQL.
  2. Waits for databases to become healthy.
  3. Pins the PHP process and database processes to specific CPU cores to ensure stable measurements.
  4. Executes phpbench within the PHP container.

Results and Analysis

Typical results (measured on PHP 8.4, Opcache enabled, Xdebug disabled):

Database Mode Subject No Cache With Cache Improvement
MySQL Server-side Prepares Simple Query ~52μs ~22μs ~57%
MySQL Server-side Prepares Complex Query ~59μs ~24μs ~59%
MySQL Emulated Prepares Simple Query ~31μs ~31μs ~0%
MySQL Emulated Prepares Complex Query ~38μs ~38μs ~0%
PostgreSQL Native Simple Query ~38μs ~37μs ~2%
PostgreSQL Native Complex Query ~41μs ~40μs ~2%

Note:
In the No Cache scenario with MySQL server-side prepared statements, the benchmark intentionally performs a full PREPARE on every execution.
This represents a worst-case usage pattern where statements are not reused at all.
The observed speedup therefore reflects the cost of repeated server-side prepares rather than the overhead of the cache itself.

Key Conclusions:

  1. MySQL Server-Side Prepared Statements: Reusing prepared statements provides the most significant performance improvement (often more than 2× faster). This is because it avoids repeated server-side PREPARE operations and query parsing.
  2. MySQL Emulated Prepared Statements: When prepared statements are emulated on the client side, caching provides no measurable benefit. In this mode, PDO already avoids additional round-trips for statement preparation.
  3. PostgreSQL: PostgreSQL handles prepared statements efficiently via the extended query protocol. In the tested scenarios, most of the execution time is dominated by network round-trips and parameter binding, resulting in only marginal gains (~1–3%) from client-side statement caching.

Benchmark scope:

These benchmarks are designed to measure adapter-level behavior in a controlled environment. Absolute numbers should not be treated as universal performance characteristics of MySQL or PostgreSQL.

Testing

Make sure the Docker containers are up and running. From the project root:

Install Dependencies

Run Tests

PHP 8.2

PHP 8.3

PHP 8.4

Run All Tests (Bash Script)

Run phpstan

License

This project is licensed under the MIT License. See the LICENSE file for details.


All versions of transaction-manager-doctrine-adapter with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-pdo Version *
aeatech/transaction-manager-core Version ^1.0
doctrine/dbal Version ^3.7 || ^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package aeatech/transaction-manager-doctrine-adapter contains the following files

Loading the files please wait ...