Download the PHP package pharako/mysql-dbal without Composer

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

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

MySQL DBAL

MySQL extensions for Doctrine DBAL.

Pharako\DBAL\Connection is an extension of Doctrine\DBAL\Connection—all functionality you get from the latter is also contained in the former, with a few add-ons specific to databases compatible with MySQL:

Supported databases

Requirements

PHP 7.2 and above. See the releases page for previous versions that still work with PHP < 7.2.

Installation

Install via Composer:

Usage

Instantiation and configuration

Most PHP frameworks will have some sort of service injection functionality to help you with configuration, but nothing stops you from doing it by hand.

Manually

Symfony 2 and above

Just specify the DBAL connection class under wrapper_class in config.yml. All other configurations should remain the same:

You can read Doctrine DBAL Configuration for more information on wrapper_class and other options.

Extra functionality

Pharako's additional methods follow the structure of Doctrine's data retrieval and manipulation functionality, including binding types.

Multiple inserts

You can insert multiple records with one call—this will hit the database only once:

Or, if you want to specify the types of the data to be inserted:

Single and multiple upserts (update if present, insert if new)

Before using this functionality, make sure you read Careful with those upserts below.

Building on the previous example and assuming the name field is a unique key in the table structure, the first two records will have their family_name fields updated to Rab and Zabb, respectively, and the last one will be inserted:

Again, this will hit the database only once.

If you want your upsert to update only a few columns and leave all the others untouched, you can pass it an array specifying those columns:

In this example, if the upsert results in an update, only the where and when fields will be updated. If the upsert results in an insert, all fields will be included.

Careful with those upserts

By and large, it is safe to execute upserts against tables of varied structures—those containing a single unique index, a multi-column unique index or even multiple unique indexes.

However, because upserts in MySQL are more involved than simple inserts and updates, you should not expect those methods to behave similarly in 100% of the cases (for example, LAST_INSERT_ID() in the context of an upsert may behave slightly differently than in that of an insert).

That's why the official documentation says that "In general, you should try to avoid using an ON DUPLICATE KEY UPDATE clause on tables with multiple unique indexes" and "[...] an INSERT ... ON DUPLICATE KEY UPDATE statement against a table having more than one unique or primary key is also marked as unsafe."

Despite that, upserts will work just as expected but in edge case scenarios. If you want to play it extra safe, though, try to tighten your tests and make sure you get the expected results when the upsert updates your records as well as when it inserts them.

Development

If you want to test this package from your workstation, checkout the development environment.

Code contributions and bug reports are welcome. For pull requests, please use the development branch.


All versions of mysql-dbal with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
doctrine/dbal Version ^2.10
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 pharako/mysql-dbal contains the following files

Loading the files please wait ....