Download the PHP package keruald/database without Composer

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

keruald/database

This library offers a simple layer of abstraction for database operations.

Configuration

To get a database instance, you need to pass configuration as an array. The properties and values depend on the engine you want to use.

MySQLi

Key Value
engine MySQLiEngine class reference
host The MySQL hostname, e.g. "localhost"
username The MySQL user to use for connection
password The clear text password to use
database The default db to select for queries (optional)
fetch_mode The default mode to fetch rows MYSQLI_ASSOC

For example:

About fetch_mode parameter

The fetch_mode parameter is used to determine how to represent results:

The code offers MYSQLI_ASSOC as default value to allow to directly represent a row result as API output and encourage to take care of the column names for better code maintenance. If you wish to switch to default MySQLi behavior, use MYSQLI_BOTH instead.

Those constants are defined by the MySQLi extension.

Legacy drivers

The mysql extension has been deprecated in PHP 5.7 and removed in PHP 7. As such, this extension isn't supported anymore. You can use straightforwardly replace 'MySQL' by 'MySQLi' as engine.

Specialized drivers for tests

Blackhole

The blackhole engine does nothing and always returns true as query result.

This engine can be used for mocks:

It can also be used with the loader, without any engine-specific configuration:

MockDatabaseEngine

The mock database is a simple implementation of the blackhole engine as mocking service to use when you want to return a deterministic response to known queries.

A benefit is you don't need a running database server for your unit tests.

You can pass to the withQueries method an array with one item per query:

To return only one row, you can use [[…]] to represent an array of one array:

The queries results are then wrapped in the MockDatabaseResult class.

When the query doesn't exist, an exception is thrown.

We recommend a mixed approach of the Blackhole engine when results don't matter, and of this class when you need some control on it.


All versions of database with dependencies

PHP Build Version
Package Version
No informations.
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 keruald/database contains the following files

Loading the files please wait ....