Download the PHP package gggeek/polyfill-pinba without Composer

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

Polyfill-Pinba

Pure-php reimplementation of the "PHP extension for Pinba".

See http://pinba.org for the original.

Requirements

PHP 5.3 or any later version.

A Pinba server to send the data to. Known servers include http://pinba.org/ and https://github.com/badoo/pinba2. Both are available as Docker Container images for trying out.

Installation

composer require gggeek/polyfill-pinba

then set up configuration settings pinba.enabled and pinba.server in php.ini as described at https://github.com/tony2001/pinba_engine/wiki/PHP-extension#INI_Directives

That's all.

NB gathering of metrics and sending them to the server is disabled by default. You have to enable it via ini settings, unless you have added explicit calls to the pinba api in your php code.

Usage

See the API described at https://github.com/tony2001/pinba_engine/wiki/PHP-extension

A trivial usage example can be found in doc/sample.php.

For viewing the gathered metrics, check out https://github.com/intaro/pinboard, https://github.com/pinba-server/pinba-server or https://github.com/ClickHouse-Ninja/Proton

Extensions to the original API

Pinba::ini_set

If the pinba php extension is not enabled in your setup (which is most likely the case, as otherwise you would not be using this package), it is not possible from php code to modify the values for ini options pinba.enabled and pinba.server. While it is possible to set their value in php.ini, if you want to modify their value at runtime you will have instead to use methods \PinbaPhp\Polyfill\pinba::ini_set($option, $value). You should also use corresponding method \PinbaPhp\Polyfill\pinba::ini_get($option) to check it.

ini option pinba.inhibited

In case you want to keep your code instrumented with pinba_timer_add, pinba_timer_stop and similar calls but are not collecting the pinba data anymore, and you want to reduce as much as possible the overhead imposed by this package, please set in pinba.inhibited=1 php.ini.

Using pinba.enabled=0 or pinba.auto_flush=0 is not recommended in that scenario, as, while they both disable the sending of data, they do not prevent timers to be actually created.

Compatibility

We strive to implement the same API as Pinba extension ver. 1.1.2.

As for the server side, the library is tested for compatibility against both a Pinba server and a Pinba2 one.

Features not (yet) supported:

Known issues - which cannot / won't be fixed:

Performances

These results are indicative of the time and memory overhead of executing 1000 function calls in a loop, and instrumenting each execution with a separate timer.

As you can see, the execution delay introduced is very small, less than 1 millisecond. The memory overhead is proportional to the number of timers added and the tags attached to each timer.

NB: weirdly enough, the php extension seems to be slightly slower on average than the pure-php implementations. Having taken a cursory look at the C code of the extension, I suspect this is because it executes too many gettimeofday calls...

In case you want to keep your code instrumented with lots of pinba_timer_start calls, and reduce the overhead of using the extension as much as possible (while of course not measuring anything anymore), you can set pinba.inhibited=1 in php.ini.

With that set, this is the overhead you can expect for "timing" 1000 executions of a function call:

(tests executed with php 7.4 in an Ubuntu Focal container, running within an Ubuntu Jammy VM with 4 vCPU allocated)

Notes

Includes code from the Protobuf for PHP lib by Iván -DrSlump- Montes: https://github.com/drslump/Protobuf-PHP

Other known packages exist implementing the same idea, such as: https://github.com/vearutop/pinba-pure-php

FAQ

Running tests

The recommended way to run the library's test suite is via the provided Docker containers and the corresponding Docker Compose configuration. A handy shell script is available that simplifies usage of Docker and Docker Compose.

The full sequence of operations is:

./tests/ci/vm.sh build
./tests/ci/vm.sh start
./tests/ci/vm.sh runtests
./tests/ci/vm.sh stop

# and, once you have finished all testing related work:
./tests/ci/vm.sh cleanup

By default, tests are run using php 7.4 in a Container based on Ubuntu 20 Focal. The data is sent to a container running the original Pinba server - it can also be configured to be sent to a container running the Pinba2 server instead.

You can change the version of PHP and Ubuntu in use by setting the environment variables PHP_VERSION and UBUNTU_VERSION before building the containers.

You can switch the target Container used for the testsuite to the one running Pinba2 by setting the environment variables PINBA_DB_SERVER=pinba2, PINBA_SERVER=pinba2 and PINBA_PORT=3002 before starting the containers.

Testing tips

License

Use of this software is subject to the terms in the license file

License Latest Stable Version Total Downloads

Build Status Code Coverage


All versions of polyfill-pinba with dependencies

PHP Build Version
Package Version
Requires php Version ^5.3.0 || ^7.0 || ^8.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 gggeek/polyfill-pinba contains the following files

Loading the files please wait ....