PHPackages                             yproximite/influxdb-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. [Database &amp; ORM](/categories/database)
4. /
5. yproximite/influxdb-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

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

Bundle service integration of official influxdb/influxdb-php client

v4.0.0(4y ago)011711MITPHPPHP ^8.0

Since Feb 13Pushed 4y agoCompare

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

READMEChangelog (2)Dependencies (8)Versions (25)Used By (1)

influxdb-bundle
===============

[](#influxdb-bundle)

**Fork of [Algatux/influxdb-bundle](https://github.com/Algatux/influxdb-bundle), seems not maintained**

**⚠ Can be deleted if Algatux/influxdb-bundle is updated ⚠**

Bundle service integration of official [influxdb/influxdb-php](https://github.com/influxdata/influxdb-php) client

[![PHP Version](https://camo.githubusercontent.com/aff0b1ebd8bae48ba12ef0b1128d6460084232cd88d6e102969df5f5eea3b35a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e302d626c75652e737667)](https://img.shields.io/badge/PHP-%5E8.0-blue.svg)

### Installation

[](#installation)

First of all, you need to require this library through composer:

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

Then, enable the bundle on the `AppKernel` class:

```
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Yproximite\InfluxDbBundle\InfluxDbBundle(),
    );

    // ...

    return $bundles
}
```

### Configuration

[](#configuration)

Here is the configuration reference:

```
influx_db:

    # If not defined, the first connection will be taken.
    default_connection:   ~
    connections:

        # Prototype
        name:

            # Your InfluxDB host address
            host:                 ~ # Required

            # Your InfluxDB database name
            database:             ~ # Required

            # Set it to true to activate the UDP connection
            udp:                  false

            # Set it to true to enable SSL over HTTP (required for Influx Cloud)
            ssl:                  false
            # Set it to true to activate the ssl verification
            ssl_verification:            false

            udp_port:             4444
            http_port:            8086
            username:             ''
            password:             ''

            # Setup timeout or connection timeout (seconds) for your requests
            timeout:              0.0
            connect_timeout:      0.0

            # Set it to false to disable the event listener configuration
            listener_enabled:     true

            # Simple override for the default event listener class (constructor args and methods must match)
            listener_class:       Yproximite\InfluxDbBundle\Events\Listeners\InfluxDbEventListener
```

If you have only one connection to configure, this can be simplified to this:

```
influx_db:
    # Your InfluxDB host address
    host:                 ~ # Required

    # Your InfluxDB database name
    database:             ~ # Required

    # Set it to true to activate the UDP connection
    udp:                  false

    # Set it to true to enable SSL over HTTP (required for Influx Cloud)
    ssl:                  false
    # Set it to true to activate the ssl verification
    ssl_verification:     false

    udp_port:             4444
    http_port:            8086
    username:             ''
    password:             ''

    # Setup timeout or connection timeout (seconds) for your requests
    timeout:              0.0
    connect_timeout:      0.0

    # Set it to false to disable the event listener configuration
    listener_enabled:     true

    # Simple override for the default event listener class (constructor args and methods must match)
    listener_class:       Yproximite\InfluxDbBundle\Events\Listeners\InfluxDbEventListener
```

### Services

[](#services)

You can directly access to the `InfluxDB\Database` through UDP or HTTP with those services:

```
$httpDatabase = $this->get('yproximite_influx_db.connection.http'); // Default HTTP connection
$udpDatabase = $this->get('yproximite_influx_db.connection.udp');   // Default UDP connection

// Same as before.
$httpDatabase = $this->get('yproximite_influx_db.connection.default.http');
$udpDatabase = $this->get('yproximite_influx_db.connection.default.udp');
```

You can also retrieve them thanks to the registry:

```
$database = $this->get('yproximite_influx_db.connection_registry')->getDefaultHttpConnection();
$database = $this->get('yproximite_influx_db.connection_registry')->getDefaultUdpConnection();

// Same as before.
$database = $this->get('yproximite_influx_db.connection_registry')->getHttpConnection('default');
$database = $this->get('yproximite_influx_db.connection_registry')->getUdpConnection('default');
```

To manipulate the database, please read the official documentation for [reading](https://github.com/influxdata/influxdb-php#reading)and [writing](https://github.com/influxdata/influxdb-php#writing-data).

### Sending data to influx db through events

[](#sending-data-to-influx-db-through-events)

Assuming this collection to send:

```
$time = new \DateTime();

$points = [new Point(
    'test_metric', // name of the measurement
    0.64, // the measurement value
    ['host' => 'server01', 'region' => 'italy'], // optional tags
    ['cpucount' => rand(1,100), 'memory' => memory_get_usage(true)], // optional additional fields
    $time->getTimestamp()
)];
```

Dispatch the event instance according to the chosen writing protocol:

```
// UDP
$container
    ->get('event_dispatcher')
    ->dispatch(InfluxDbEvent::NAME, new UdpEvent($points, Database::PRECISION_SECONDS));

// HTTP
$container
    ->get('event_dispatcher')
    ->dispatch(InfluxDbEvent::NAME, new HttpEvent($points, Database::PRECISION_SECONDS));
```

Or, if you prefer to defer the event:

```
// Deferred Events
// Collect your measurements during the request and make only one write to influxdb.
// Deferred events are catched and "stored". Than on the kernel.terminate event one write per
// event type and precision will be fired.

// UDP
$container
    ->get('event_dispatcher')
    ->dispatch(InfluxDbEvent::NAME, new DeferredUdpEvent($points, Database::PRECISION_SECONDS));

// HTTP
$container
    ->get('event_dispatcher')
    ->dispatch(InfluxDbEvent::NAME, new DeferredHttpEvent($points, Database::PRECISION_SECONDS));
```

If you want to write to another connection than the default, you must specify it:

```
// UDP
$container
    ->get('event_dispatcher')
    ->dispatch(InfluxDbEvent::NAME, new UdpEvent($points, Database::PRECISION_SECONDS, 'other_connection'));

// HTTP
$container
    ->get('event_dispatcher')
    ->dispatch(InfluxDbEvent::NAME, new HttpEvent($points, Database::PRECISION_SECONDS, 'other_connection'));
```

### Commands

[](#commands)

Some commands are provided:

- `yproximite:influx:database:create`: To create the database.
- `yproximite:influx:database:drop`: To drop the database.

To get more information, run:

```
./app/console help
```

### Form types

[](#form-types)

This bundle provides several pre-defined form types. They are useful but optional.

If you want to use them, you have to require the `symfony/form` package.

Description of each of them is on the class doc block. Here is a short usage example:

```
$form
    ->add('measurement', MeasurementType::class, [
        'connection' => 'default' // Optional: The connection you want to use.
    ])
    ->add('fields', FieldKeyType::class, [
        'measurement' => 'cpu', // The concerned measurement.
        'multiple' => true, // Parent type is ChoiceType. You can use parent option like multiple.
    ])
    ->add('tags', TagKeyType::class, [
        'measurement' => 'cpu',
        'exclude_host' => false, // True by default. Excludes the 'host' choice value.
        'multiple' => true,
    ])
    ->add('tag_value', TagValueType::class, [
        'measurement' => 'disk',
        'tag_key' => 'fstype', // The related tag key.
    ])
;
```

### Custom event listeners

[](#custom-event-listeners)

In order to make it more flexible, you can override or even completely disable the default event listener and implement your own.

It is useful i.e. if you want to add additional logging or error handling around the actual database calls.

### Contributing

[](#contributing)

Feel free to contribute by opening a pull request, if you find a bug or to suggest a new feature. If you like docker, this repository is provided with a dev environment with some scripts to prepare and use it. All you need is docker and docker-compose installed on your system.

```
 make setup  # will build the needed containers and setup the project

```

```
 make start  # will start the needed containers and put you inside the php-cli container

```

```
 make test  # will launch the test suite

```

Note: All these scripts are meant to be used outside the containers.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 58.1% 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 ~119 days

Recently: every ~315 days

Total

20

Last Release

1460d ago

Major Versions

0.1b → 1.0.02016-02-18

1.x-dev → 2.0.02016-06-06

2.4.0 → 3.0.0-beta-12020-04-05

v3.1.0 → v4.0.02022-05-10

PHP version history (5 changes)0.1bPHP &gt;=7.0

1.1.0PHP ^7.0

3.0.0-beta-1PHP ^7.2

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)

---

Top Contributors

[![Algatux](https://avatars.githubusercontent.com/u/888864?v=4)](https://github.com/Algatux "Algatux (118 commits)")[![soullivaneuh](https://avatars.githubusercontent.com/u/1698357?v=4)](https://github.com/soullivaneuh "soullivaneuh (45 commits)")[![Kocal](https://avatars.githubusercontent.com/u/2103975?v=4)](https://github.com/Kocal "Kocal (15 commits)")[![RomulusED69](https://avatars.githubusercontent.com/u/9000452?v=4)](https://github.com/RomulusED69 "RomulusED69 (9 commits)")[![nibynool](https://avatars.githubusercontent.com/u/2154482?v=4)](https://github.com/nibynool "nibynool (5 commits)")[![smatyas](https://avatars.githubusercontent.com/u/534550?v=4)](https://github.com/smatyas "smatyas (3 commits)")[![salvatorecordiano](https://avatars.githubusercontent.com/u/2036080?v=4)](https://github.com/salvatorecordiano "salvatorecordiano (2 commits)")[![AlessandroGalliDcb](https://avatars.githubusercontent.com/u/158145359?v=4)](https://github.com/AlessandroGalliDcb "AlessandroGalliDcb (2 commits)")[![Aliance](https://avatars.githubusercontent.com/u/7838144?v=4)](https://github.com/Aliance "Aliance (1 commits)")[![dkarlovi](https://avatars.githubusercontent.com/u/209225?v=4)](https://github.com/dkarlovi "dkarlovi (1 commits)")[![Jerome1337](https://avatars.githubusercontent.com/u/7968649?v=4)](https://github.com/Jerome1337 "Jerome1337 (1 commits)")[![curry684](https://avatars.githubusercontent.com/u/1455673?v=4)](https://github.com/curry684 "curry684 (1 commits)")

---

Tags

symfonydatabaseinfluxdb

### Embed Badge

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

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

###  Alternatives

[algatux/influxdb-bundle

Bundle service integration of official influxdb/influxdb-php client

23346.2k](/packages/algatux-influxdb-bundle)[backup-manager/symfony

A simple database backup manager for Symfony2 with support for S3, Rackspace, Dropbox, FTP, SFTP.

119293.7k3](/packages/backup-manager-symfony)[doesntmattr/mongodb-migrations-bundle

Symfony MongoDBMigrationsBundle

23484.5k1](/packages/doesntmattr-mongodb-migrations-bundle)[webonaute/doctrine-fixtures-generator-bundle

Generate Fixture from your existing data in your database. You can specify the Entity name and the IDs you want to import in your fixture.

67184.1k](/packages/webonaute-doctrine-fixtures-generator-bundle)

PHPackages © 2026

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