Download the PHP package foglcz/dibiproxy without Composer

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

DibiProxy

This is collection of "proxy drivers" for dibi database layer, which you can obtain on http://www.dibiphp.com

Why

Everyone knows the drill. When you're going to present something somewhere, you have whole project running on your local machine. This approach works for most of the cases, however we have been faced a problem. Let's outline:

So we decided to take another approach. Let's install the-least-needed database for the presentation. As the project has been using dibi as DBAL, we have created proxy classes instead.

How

The proxy classes sit on top of the actual database drivers, caching all the queries and their results. When database is not available, data are loaded from cache.

As some of the queries are changing data & are loading result ids, we implemented "override" concept, where the results are not cached by the query, but by the override key instead. So, data changing queries (like inserts) have pre-defined key under which they are saved & loaded from the cache later.

Installation

Simply put into your composer.json:

require {
  "foglcz/dibiproxy": "1.*"
}

Due to dibi driver loading process, you need to include appropiate driver before you use it:

require_once 'vendor/foglcz/dibiproxy/lib/drivers/your.selected.driver.php';

Then, just use the common driver with "Proxy" prefix and enable the proxying:

$config['driver'] = 'proxymysqli';
$config['proxy'] = 'path_to_proxy_file.dat';

If you have data-changing queries (inserts/update), you should then use different class for connecting to database:

dibiProxy::connect($config);

Afterwards, feel free to use the dibi:: class as usual for all data manipulation.

Usage

When using the "proxy" configuration parameter, you SHOULD supply the path to file, where proxy data will be saved. If you just provide "true", but not string, the classes will automatically create datafile in the place of lib/ class.

The classes work transparently, hence the update to proxying classes has no other steps. The proxying is used when no database connection is available. Our usage is, that we click-through the entire project on local machine while the connection is available - then we destroy the config parameters so that the project does NOT connect. This time, we verify the result - everything should work as default.

Data changing queries

If you have some update/insert/delete queries, which you want to include, before calling dibi::query() and/or $connection->* functions, you need to call override:

dibi::setProxyOverride('some.ident.of.the.query');

This will result in caching the query results under this static identifier. Hence, you can have database-changing queries running on proxied project.

Nette framework loading

If you're using Nette Framework (that awesome thing can be obtained at http://www.nette.org ) with the dibi driver within config.neon file, load the proxied classes this way:

database:
    driver: ProxyMysqli

services:
    database: DibiProxyConnection(%database%)

... which basically means exchanging the driver within config parameters & changing the connection class name (= changing DibiConnection --> DibiProxyConnection).

PHP 5.3 or 5.2

The DibiProxy classes exploit PHP 5.4 Trait fetature. However, as the Dibi has support for PHP 5.2, should you want to run DibiProxy on older version of php, you need to do one simple change.

The resulting file would be then looking like this: https://gist.github.com/5464ca39375ddacf0041

Esentialy, this is what php parser does with traits. They are basically assisted copy-paste, wchich is precisely the reason why we used them.

Author and license

Created with love by Pavel Ptacek (c) 2012.

(these classes has been created within 2 hours during night hackathon before the presentation. Pull requests welcome.)


All versions of dibiproxy with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
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 foglcz/dibiproxy contains the following files

Loading the files please wait ...