PHPackages                             yproximite/influxdb-preset-bundle - 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. yproximite/influxdb-preset-bundle

ActiveSymfony-bundle

yproximite/influxdb-preset-bundle
=================================

InfluxDbPresetBundle: send metrics to InfluxDB server based on Events

v4.1.0(4y ago)820.2kMITPHPPHP ^8.0

Since Dec 13Pushed 4y ago6 watchersCompare

[ Source](https://github.com/Yproximite/influxdb-preset-bundle)[ Packagist](https://packagist.org/packages/yproximite/influxdb-preset-bundle)[ RSS](/packages/yproximite-influxdb-preset-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (7)Versions (17)Used By (0)

InfluxDbPresetBundle
====================

[](#influxdbpresetbundle)

[![CI (master)](https://github.com/Yproximite/influxdb-preset-bundle/workflows/CI/badge.svg)](https://github.com/Yproximite/influxdb-preset-bundle/workflows/CI/badge.svg)[![PHP Version](https://camo.githubusercontent.com/aff0b1ebd8bae48ba12ef0b1128d6460084232cd88d6e102969df5f5eea3b35a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e302d626c75652e737667)](https://img.shields.io/badge/PHP-%5E7.0-blue.svg)

InfluxDbPresetBundle: send metrics to InfluxDB server based on `Events`

Since it relies on the great official [influxdb-php](https://github.com/influxdata/influxdb-php) library client (via the [Symfony bundle](https://github.com/Yproximite/influxdb-bundle)) you can configure the latter to benefit from:

- Send multiple metrics at once (batch sending)
- Udp Events (sends the metrics using UDP)
- Http Events (sends the metrics to the InfluxDB API over HTTP)

Both methods (Udp/Http) can also be deferred, meaning you can send the metrics only when `kernel.terminate` event is fired in order not to slow your application. You can read more on the documentation of [influxdb-bundle](https://github.com/Yproximite/influxdb-bundle#sending-data-to-influx-db-trough-events)

[![profiler_influx](https://cloud.githubusercontent.com/assets/9335422/21149456/d2f74b1c-c15b-11e6-9f89-eb7a2fabb754.png)](https://cloud.githubusercontent.com/assets/9335422/21149456/d2f74b1c-c15b-11e6-9f89-eb7a2fabb754.png)

This bundle is inspired from [StatsdBundle](https://github.com/M6Web/StatsdBundle)

- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)

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

[](#installation)

Require [`yproximite/influxdb-preset-bundle`](https://packagist.org/packages/yproximite/influxdb-preset-bundle)to your `composer.json` file:

```
$ composer require yproximite/influxdb-preset-bundle
```

Register the bundle in `app/AppKernel.php`:

```
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Yproximite\Bundle\InfluxDbPresetBundle\YproximiteInfluxDbPresetBundle(),
        new Yproximite\InfluxDbBundle\InfluxDbBundle(),
    );
}
```

Also, be sure that you followed the [configuration procedure for influxdb-bundle](https://github.com/Yproximite/influxdb-bundle) since it uses it to take the pre-configured service to communicate with the InfluxDB server.

Configuration
-------------

[](#configuration)

Here is the configuration reference:

```
# app/config/config.yml
yproximite_influx_db_preset:
    default_profile_name: default # by default it's "default"
    profiles:
        default:
            connections:
                default:
                    protocol: udp
                    deferred: true
            presets:
                app.user.created:
                    measurement: users
                    tags: { type: member, action: created, free: yes, foo: bar }
                    fields: { extra_value: true }
                api.company.created:
                    measurement: api
                    tags: { action: created, object: company }
                api.company.deleted:
                    measurement: api
                    tags: { action: deleted, object: company }
                app.memory_usage:
                    measurement: app_memory_usage
                    tags: { metric_type: memory }
                app.exception:
                    measurement: app
                    tags: { metric_type: exception, code: "" }
                app.page_views:
                    measurement: app
                    tags: { metric_type: page_views }
        other:
            connections:
                default:
                    protocol: http
            presets:
                app.response_time:
                    measurement: app
                    tags: { metric_type: response_time }
                app.order.requested:
                    measurement: orders
                    tags: { action: requested, delivery: false }
                    fields: { extra_value: true }
    extensions:
        memory:
            enabled: true
            preset_name: app.memory_usage
        response_time:
            enabled: true
            preset_name: app.response_time
            profile_name: other # by default it's "default"
        exception:
            enabled: true
            preset_name: app.exception
        request_count:
            enabled: true
            preset_name: app.page_views

# influx_db:
#     default_connection:   ~
#     connections:
#         default:
#             host:                 influxdb.example.com
#             database:             my_db
#             udp:                  true
#             udp_port:             4444
#             http_port:            8086
#         other:
#             host:                 important.example.com
#             database:             my_db
#             udp:                  false
#             udp_port:             4444
#             http_port:            8086
```

Usage
-----

[](#usage)

### Sending

[](#sending)

through events:

```
use Yproximite\Bundle\InfluxDbPresetBundle\Event\InfluxDbEvent;

// Symfony\Component\EventDispatcher\EventDispatcherInterface
$eventDispatcher = $this->get('event_dispatcher');

// Preset from default profile
$eventDispatcher->dispatch('app.user.created', new InfluxDbEvent(1));

// Advanced event parameters
$event = new InfluxDbEvent(
    $value = 1, // will be converted to float
    string $profileName = 'other',
    ?\DateTimeInterface $dateTime = new \DateTime()
);

$eventDispatcher->dispatch('app.order.requested', $event);
```

using the client:

```
// Yproximite\Bundle\InfluxDbPresetBundle\Client\ClientInterface
$client = $this->get('yproximite.influx_db_preset.client.client');

$client->sendPoint(
    string $profileName = 'other',
    string $presetName = 'app.user.created',
    float $value = 0.5,
    ?\DateTimeInterface $dateTime = new \DateTime()
);
```

### Listening for events

[](#listening-for-events)

you can listen each client request through `ClientRequestEvent`:

```
use Yproximite\Bundle\InfluxDbPresetBundle\Event\ClientRequestEvent;

final class MyAppListener
{
    public function onClientRequest(ClientRequestEvent $event)
    {
        dump(
            $event->getProfileName(),
            $event->getPresetName(),
            $event->getValue(),
            $event->getDateTime()
        );
    }
}
```

do not forget to add the following code into `services.yml`:

```
services:
    app.event_listener.my_app_listener:
        class: AppBundle\EventListener\MyAppListener
        tags:
            - { name: kernel.event_listener, event: yproximite.bundle.influx_db_preset.client_request, method: onClientRequest }
```

You can enable `extensions` that will automatically (see configuration example) send the metrics for the memory usage, how much time the `Request/Response` cycle last, the status code of errors and the quantity of page views.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~131 days

Recently: every ~140 days

Total

16

Last Release

1461d ago

Major Versions

v1.0.4 → v2.0.02017-11-21

v2.1.0 → v3.0.02020-06-23

v3.2.0 → v4.0.02022-05-10

PHP version history (4 changes)v1.0.0PHP ^7.0

v2.1.0PHP ^7.3

v3.1.0PHP ^7.3 || ^8.0

v4.0.0PHP ^8.0

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/ef2712905e1b2ba2e132f744ea640cd0b73d2ef025744044a45113d1fdfaf88c?d=identicon)[ClementYproximite](/maintainers/ClementYproximite)

---

Top Contributors

[![n-sviridenko](https://avatars.githubusercontent.com/u/9335422?v=4)](https://github.com/n-sviridenko "n-sviridenko (41 commits)")[![RomulusED69](https://avatars.githubusercontent.com/u/9000452?v=4)](https://github.com/RomulusED69 "RomulusED69 (27 commits)")[![tristanbes](https://avatars.githubusercontent.com/u/346010?v=4)](https://github.com/tristanbes "tristanbes (13 commits)")[![Kocal](https://avatars.githubusercontent.com/u/2103975?v=4)](https://github.com/Kocal "Kocal (7 commits)")

---

Tags

influxinfluxdbinfluxdb-bundlemetricsphpsymfony-bundleMetricsdbinfluxdbinfluxstatistics

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/yproximite-influxdb-preset-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/yproximite-influxdb-preset-bundle/health.svg)](https://phpackages.com/packages/yproximite-influxdb-preset-bundle)
```

###  Alternatives

[slickdeals/statsd

a PHP client for statsd

264.5M8](/packages/slickdeals-statsd)[algatux/influxdb-bundle

Bundle service integration of official influxdb/influxdb-php client

23346.2k](/packages/algatux-influxdb-bundle)[tuupola/instrument

Application metrics toolbox for InfluxDB

4214.3k1](/packages/tuupola-instrument)[tuupola/instrument-middleware

PSR-7 Middleware for instrumenting PHP applications

102.9k](/packages/tuupola-instrument-middleware)

PHPackages © 2026

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