Download the PHP package garkavenkov/db-connector without Composer

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

db-connector

DBConnect - Class-wrapper for PDO Class.

Installation

Use Composer

composer require garkavenkov/db-connector

Usage

Initialization

There are two ways to set database configuration parameters. First one is through constants.

Second one is through an associative array as a parameter in getInstance() method.

By default database parameter db_port is empty, thus database driver uses its own default port. If you need to use specific port number you must define it as a constant

or as an associative array.

Methods

exec(string $sql)

Executes an SQL statement and returns the number of affected rows

Output:

query(string $sql)

Executes an SQL statement and returns an DBConnect object with result set as a PDOStatement object.

For example, this code set UTF8 code

Output:

After this method you can chain another method that works with PDOStatement object. For example getRow()

getRow($fetch_style = null)

Fetches a row from a result set. The $fetch_style determines how PDO returns the row. By default uses PDO::FETCH_ASSOC

Output:

For getting result as an object use PDO::FETCH_OBJ

Output:

getRows($fetch_style = null)

Returns an array containing all of the result set rows. Result depends on $fetch_style. By default uses PDO::FETCH_ASSOC

prepare(string $sql, $standalone = false)

Prepares an SQL statement for execution and returns DBConnect object that contains prepared PDOstatement.

Output:

If you set $standalone=true, this method returns a PDOstatement object rather than DBConnect object.

Output

execute(array $params, $stmt = null)

Executes a prepared statement.

If you set $stmt parameter this method will execute standalone prepared statement.

getLastInsertedId()

Returns Id from last inserted record

Output:

getFieldValue(string $field_name)

Returns value of particular field

Output:

getFieldValues(string $field_name)

Returns an array that contains values from given field

Output:

rowCount()

Returns the number of rows affected by the last SQL statement.

Output:

closeCursor()

Closes cursor for next execution.

getAvailableDrivers()

Returns an array of available PDO drivers.

Output:


All versions of db-connector 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 garkavenkov/db-connector contains the following files

Loading the files please wait ....