Download the PHP package simbiat/database without Composer

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

Database Pool and Controller

This is a set of 3 classes for convenience of work with databases, a wrapper and sugar for PHP's PDO.

Classes

How to use

Please, note, that I am using MySQL as 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.

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

The above line is the minimum you will require. Additionally, you can set driver options like this:

After you set it up to your liking (can be done in one line), you need to add it to pool:

Passing ID is not required but will improve your life if you will need to juggle multiple connections.

You can also pass the third argument (maxTries), if you want to have the script to retry connection, in case of failures. Default is 1.

If connection is established successfully you then can get \PDO object for it by not sending any parameters to the pool:

Or sending a previous $config or connection ID if you need a specific one. \Controller class uses variant without parameters for flexibility, but can be overridden, if deemed necessary.

If connection failed, you will be able to get errors using

To utilize \Controller you need to establish as shown above and then call either it query() function or any of the wrappers. For example, this line will count rows in a table and return only the number of those rows, that is an integer:

This one will return a boolean, advising if something exists in a table:

The above example also shows one of possible ways to set bindings. Regular \PDO allows binding values like hook, value, type, but \Controller expects an array for value if you want to send a non-string one or a special value, like the above mentioned time. Since We are sending an empty value for time \Controller will take current microtime and convert and bind it in Y-m-d H:i:s.u format.


All versions of database with dependencies

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

Loading the files please wait ....