Download the PHP package simbiat/db-pool without Composer

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

Database Pool

This is a set of 2 classes for convenience of work with database connections using PDO.

Classes

How to use

Please, note that I am using MySQL as the main DB engine in my projects, thus I may miss some peculiarities of other engines. Please, let me know of them, so that they can be incorporated.

Connection

First you need to create a Connection object and set its parameters like this:

The above line is the minimum you will require, and the respective methods in the chain should be self-explanatory. Below is the list of other setters that you may need depending on your needs and driver used:

All of the above methods can be chained, and all have respective getters (just replace set with get).

setOption

While setOption is mostly a (kind of) wrapper to setAttribute, some settings are forced inside it (or rather getOptions):

Connection strings

There are several functions available to generate connection strings or their parts in different flavors:

Pool

After you set a connection up to your liking, you need to add it to pool:

If connection is established successfully you then can get PDO object for it by not sending any parameters to the pool (unless you saved it to a variable from the start):

openConnection also support 3 optional parameters:

Once you have a set of connections in a pool, to get the object for specific one, you either send the original Connection object or its ID. To change current "active" connection (that is the one returned when openConnection is called without parameters) use changeConnection in the same manner. closeConnection with respective connection details will close it (remove from pool), and to clean the pool entirely use cleanPool. Use showPool() to see all open connections, including their IDs.

Class also has checkAttributeValue. It's essentially a wrapper for getAttribute, but also allows to compare it to a desired value and return a bool result:


All versions of db-pool with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-pdo Version *
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 simbiat/db-pool contains the following files

Loading the files please wait ...