Download the PHP package faster-php/db without Composer

On this page you can find all versions of the php package faster-php/db. 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 db

FasterPHP/Db

FasterPHP/Db is a high-performance, drop-in replacement for PHP's native PDO class. It enhances standard database operations with advanced features designed for robust, modern applications β€” all while retaining full compatibility with PDO interfaces and expectations.

If you're tired of dealing with intermittent MySQL timeouts or disconnects, repetitive statement preparation, or clunky connection logic, this package gives you a clean, extensible, and efficient solution that just works β€” no learning curve required.

Key features:


πŸš€ Installation


βœ… Requirements


πŸ“¦ Basic Usage


πŸ” Auto-Reconnect

If a connection is lost (e.g. due to a timeout), FasterPhp\Db automatically reconnects, re-prepares (where necessary), and re-executes the statement.

Configurable Retry with Exponential Backoff

The DefaultStrategy supports configurable retry attempts with exponential backoff:

With these settings, reconnect attempts will wait 100ms, then 200ms, then 400ms between retries.

Transaction-Aware Reconnect Protection

Reconnecting mid-transaction would silently lose uncommitted changes. FasterPhp\Db prevents this by throwing a DbException if a reconnectable error occurs during an active transaction:

This protection works for both explicit transactions (beginTransaction()) and raw SQL transactions (BEGIN/START TRANSACTION).

PSR-3 Logging

You can attach a PSR-3 compatible logger to monitor reconnect events:

Custom Reconnect Strategy

You can configure reconnect patterns via Config\ArrayProvider or inject a custom ReconnectStrategy by implementing Reconnect\StrategyInterface.


βš™οΈ Statement Caching

Prepared statements are cached internally to avoid repeated preparation overhead:

To clear the statement cache (e.g. after schema changes or to free memory):


πŸ”§ Advanced Usage

πŸ“‘ ConnectionManager

The ConnectionManager class enables application-wide connection pooling and shared configuration. It’s ideal for large applications, services, or frameworks that require multiple named database instances or shared lifecycle control.

πŸ’‘ ConnectionManager will automatically reuse idle connections if available.


βš™οΈ Configuration Providers

The Config\ArrayProvider class is a simple implementation of the ProviderInterface that lets you define connection settings in plain PHP arrays.

To use a different configuration source (like .env, JSON, or YAML), implement:

This keeps your configuration logic separate from your application logic, and makes it easy to test or extend.


πŸ§ͺ Testing

Tests require a MySQL server with a testdb database. You can configure your environment using .env variables or phpunit.xml:

Run tests with:

To generate a coverage report (requires Xdebug or PCOV):


🀝 Contributing

Contributions are welcome! To get started:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -am 'Add feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a pull request

🧭 Code of Conduct

Please be respectful and constructive in all interactions. We aim to foster a professional, welcoming environment.


πŸ” Security

If you discover a security vulnerability, please report it privately via GitHub or email the maintainer. Avoid opening public issues for sensitive disclosures.


πŸ“„ License

This package is open-source software licensed under the MIT license.


All versions of db with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-pdo Version *
psr/log Version ^3.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 faster-php/db contains the following files

Loading the files please wait ...