PHPackages                             endeveit/btp-api - 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. endeveit/btp-api

ActiveLibrary

endeveit/btp-api
================

API library for BTP daemon.

36.6k1PHP

Since Apr 26Pushed 10y ago1 watchersCompare

[ Source](https://github.com/endeveit/btp-api)[ Packagist](https://packagist.org/packages/endeveit/btp-api)[ RSS](/packages/endeveit-btp-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

BTP API
=======

[](#btp-api)

API library for [BTP daemon](https://github.com/mambaru/btp-daemon).

BTP daemon is performance analysis daemon from developers of [Mamba](http://corp.mamba.ru) portal.

This library is PHP 5.3 port of official old-style [library](https://github.com/mambaru/btp-api).

Example of usage
----------------

[](#example-of-usage)

Let's say you have a code like this:

```
function getSomethingFromDatabase()
{
    $data   = Database::getConnection()->query('SELECT * FROM `table` WHERE `id` IN (1, 2)');
    $result = array();

    foreach ($data as $row) {
        $result[] = $row[];
    }

    return $result;
}
```

First we should instantiate new Btp\\Api\\Connection object:

```
use Btp\Api\Connection;

$btpConnection = new Connection();
```

Now we can work with counters.

There is two ways to use them:

- The explicit stop of counter.

```
// Will be measured only time of Database::getConnection()->query()
function getSomethingFromDatabase(Connection $btpConnection)
{
    $counter = $btpConnection->getCounter(array(
        'srv'     => 'db7',
        'service' => 'mysql',
        'op'      => 'select',
    ));

    $data = Database::getConnection()->query('SELECT * FROM `table` WHERE `id` IN (1, 2)');
    $counter->stop();

    $result = array();

    foreach ($data as $row) {
        $result[] = $row[];
    }

    return $result;
}
```

- Counter stop in destructor.

```
// Will be measured all operations from time of counter initialization till the function
// return statement (when the Btp\Api\Counter object's destructor will be called)
function getSomethingFromDatabase(Connection $btpConnection)
{
    $counter = $btpConnection->getCounter(array(
        'srv'     => 'db7',
        'service' => 'mysql',
        'op'      => 'select',
    ));

    $data   = Database::getConnection()->query('SELECT * FROM `table` WHERE `id` IN (1, 2)');
    $result = array();

    foreach ($data as $row) {
        $result[] = $row[];
    }

    return $result;
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f13cc40ecd298e7dd40094fef23d6365c80c53a045f05d0811b73abd0552b6b?d=identicon)[endeveit](/maintainers/endeveit)

---

Top Contributors

[![endeveit](https://avatars.githubusercontent.com/u/197781?v=4)](https://github.com/endeveit "endeveit (8 commits)")[![Stas-Ghost](https://avatars.githubusercontent.com/u/1543495?v=4)](https://github.com/Stas-Ghost "Stas-Ghost (1 commits)")

### Embed Badge

![Health badge](/badges/endeveit-btp-api/health.svg)

```
[![Health](https://phpackages.com/badges/endeveit-btp-api/health.svg)](https://phpackages.com/packages/endeveit-btp-api)
```

PHPackages © 2026

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