Download the PHP package chsxf/pdo-database-manager without Composer

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

About This Project

The main purpose of this package is to extend the capabilities of PDO by prodiving useful query methods to allow redaction of faster, safer and more reliable code.

Legacy Repository

I originally wrote this package while working on several tools and websites for my now defunct videogame studio called Cheese Burgames. As a fork, this repository is a continuation of the project.

Conventions

This repository uses gitmoji for its commit messages.

Getting Started

Requirements

Installation

We strongly recommend using Composer to install this package.

Usage

The following uses a MySQL database but the same applies for all database servers supported by PDO. Adaptations may be needed though.

Initialization

First, we have to load and initialize the database manager. PDO uses a Data Source Name, or DSN, to convey connection information.

General Queries

You can use the query method to execute any query you like. In the context of this example, we create a temporary table to proceed with the rest of the helper functions.

Both query and exec methods have been overridden to support error logging, among other things.

As most methods of the DatabaseManager class, query returns false in case of an error, so you can act accordingly.

Executing Altering Statements with Placeholders

Use the exec method in order to retrieve the number of affected rows by an alterning statement like UPDATE or DELETE. In complement of error logging, this method has been overridden to allow execution of statements with placeholders and values in one call.

Retrieving a Single Specific Value

Use the getValue method to retrieve a single value from your database. As for the exec method, you can pass a statement with placeholders along with the replacement values in a single call, improving security and productivity.

Retrieval of a Specific Column

The getColumn method fetches the values of the first column returned by the provided statement.

Outputs:

Retrieval of a Specific Row

The getRow method fetches the first row returned by the provided statement.

Along with the get and getIndexed methods, you can specify how rows are fetched. At the moment, only PDO::FETCH_ASSOC, PDO::FETCH_NUM, PDO::FETCH_OBJ and PDO::FETCH_BOTH (PHP's default) are supported.

Outputs:

Retrieval of Several Rows

The get method fetches all rows returned by the previded statement.

Outputs:

Retrieval of Rows Indexed by a Field Value

The getIndexed method fetches all rows returned by the provided statement, indexed by the value of a specific field.

Outputs:

Retrieval of Pairs of Values

The getPairs method fetches pairs of values returned by the provided statement. The values of the first and second returned columns are used respectively as keys and values of the returned array.

Outputs:

Error Logging

The DatabaseManager class provides an optional error logging system that can help a lot with debugging.

The errors are logged directly into the database in a specific table. It is obviously NOT RECOMMENDED to use this error logging system in production environments.

To enable error logging, pass true to the $useDatabaseErrorLogging parameter in the constructor.

Error Table Structure

In order to work, your database must include a table with the following structure:

By default, the name of the table is database_errors, but you can change it by defining a constant named chsxf\PDO\ERRORS_TABLE before loading the DatabaseManager class.

License

This project is released under the terms of the MIT License.


All versions of pdo-database-manager with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.7
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 chsxf/pdo-database-manager contains the following files

Loading the files please wait ....