PHPackages                             foglcz/dibiproxy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. foglcz/dibiproxy

ActiveLibrary

foglcz/dibiproxy
================

Collection of proxy drivers for dibi database layer.

v1.0.2(13y ago)018New BSDPHPPHP &gt;=5.4.0

Since Oct 15Pushed 13y ago1 watchersCompare

[ Source](https://github.com/foglcz/DibiProxy)[ Packagist](https://packagist.org/packages/foglcz/dibiproxy)[ Docs](http://github.com/foglcz/DibiProxy)[ RSS](/packages/foglcz-dibiproxy/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (4)Used By (0)

DibiProxy
---------

[](#dibiproxy)

This is collection of "proxy drivers" for dibi database layer, which you can obtain on

Why
---

[](#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:

> - The website we have presented is connected to our ERP system
> - Internet connection is not available in the meeting, our account manager has to present local installation
> - We did not feel comfortable putting whole ERP on our account managers laptop

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
---

[](#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 &amp; 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 &amp; loaded from the cache later.

Installation
------------

[](#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
-----

[](#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
---------------------

[](#data-changing-queries)

If you have some update/insert/delete queries, which you want to include, before calling dibi::query() and/or $connection-&gt;\* 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
-----------------------

[](#nette-framework-loading)

If you're using Nette Framework (that awesome thing can be obtained at  ) 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 &amp; changing the connection class name (= changing DibiConnection --&gt; DibiProxyConnection).

PHP 5.3 or 5.2
--------------

[](#php-53-or-52)

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.

- First, pick the driver you want to use - eg. ProxyMysqli. That one is found within lib/drivers/ProxyMysqli.php
- Edit the ProxyMysqli.php file and remove the "use" line
- Open file lib/ProxyTrait.php and copy contents of the trait DibiProxyTrait { /\* copy the content within brackets [\*](#id1)/ }
- Put the content of the trait in place of the line, which contains use statement.
- Copy the exception definitions from the bottom of the trait file, and put them into the driver file.

The resulting file would be then looking like this:

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
------------------

[](#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.)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

4961d ago

PHP version history (2 changes)v1.0PHP &gt;=5.3.2

v1.0.2PHP &gt;=5.4.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/767839?v=4)[Pavel Ptacek](/maintainers/foglcz)[@foglcz](https://github.com/foglcz)

---

Top Contributors

[![foglcz](https://avatars.githubusercontent.com/u/767839?v=4)](https://github.com/foglcz "foglcz (4 commits)")

---

Tags

dibi

### Embed Badge

![Health badge](/badges/foglcz-dibiproxy/health.svg)

```
[![Health](https://phpackages.com/badges/foglcz-dibiproxy/health.svg)](https://phpackages.com/packages/foglcz-dibiproxy)
```

###  Alternatives

[cuonggt/laravel-dibi

An elegant GUI database management tool for your Laravel applications.

5814.2k](/packages/cuonggt-laravel-dibi)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
