Download the PHP package mk/database-connection-handler without Composer

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

DatabaseConnectionHandler

Codacy Badge Latest Stable Version Latest Unstable Version License

DatabaseConnectionHandler is a simple PDO wrapper. The DatabaseConnectionHandler allows easy access to a MySQL database through PDO. It includes a singleton pattern which can be used to open up only one database connection throughout the whole project, so that your application not run into handling to many connections to your database. It also has a certain use pattern which is described below.

Requirements

Installation

Composer

composer require mk/database-connection-handler

Manually

  1. Just copy the included files into a folder in your project and include the DatabaseConnectionHandler.php wherever you want in your php files to use it.
  2. To give the connection credentials for your own database please edit the file DataBaseConnection.php and fill out the placeholders with your own mysql server informations.

Roadmap / Specifications

Usage

Namespace

Use \MK\DB as namespace.

Open up connection / create an instance

After including DatabaseConnectionHandler.php into a php file you need the get the current instance over the static function getInstance(). After that you are ready to query your database.

Query the database

After creating an instance of the DatabaseConnectionHandler you can use the query() method to either fetch results or just query inserts or anything else.

The query() method has two parameters:

A query with parameters is build up like any query in PDO you use "?" to signal the DatabaseConnectionHandler that there is a matching argument for the placeholder in the \$arguments array. So i.e.:

This prepared statement behaviour also work as in pure PDO with named placeholders:

Get results from your query

To get results for your query every query() method call returns a DatabaseResult object. This object holds all the queried data and also the selected rows of the query and the last insert id, if it's meaningful.

The DatabaseResult has the following methods:

Here is a simple example of how to use the DatabaseResult object:


All versions of database-connection-handler with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.1
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 mk/database-connection-handler contains the following files

Loading the files please wait ....