PHPackages                             babymarkt/influxdb2-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. babymarkt/influxdb2-bundle

ActiveSymfony-bundle

babymarkt/influxdb2-bundle
==========================

Bundle service integration of official influxdata/influxdb-client-php client package

v1.0.0(4y ago)02.7kMITPHPPHP &gt;=8.0

Since Jan 16Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Baby-Markt/influxdb2-bundle)[ Packagist](https://packagist.org/packages/babymarkt/influxdb2-bundle)[ RSS](/packages/babymarkt-influxdb2-bundle/feed)WikiDiscussions 1.x Synced 4w ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

InfluxDB2 Symfony Bundle
========================

[](#influxdb2-symfony-bundle)

Symfony bundle integration of the official [InfluxDB 2.x client](https://github.com/influxdata/influxdb-client-php).

[![Build 1.x](https://github.com/Baby-Markt/influxdb2-bundle/actions/workflows/php.yml/badge.svg?branch=1.x)](https://github.com/Baby-Markt/influxdb2-bundle/actions)[![codecov](https://camo.githubusercontent.com/db90611823119528b7c7548e9a171ef82798e35b5e25f6e5f46ac6dbc63f474e/68747470733a2f2f636f6465636f762e696f2f67682f426162792d4d61726b742f696e666c75786462322d62756e646c652f6272616e63682f312e302e782d6465762f67726170682f62616467652e7376673f746f6b656e3d4e384d4f4c4f424e5739)](https://codecov.io/gh/Baby-Markt/influxdb2-bundle)[![Packagist Version](https://camo.githubusercontent.com/f18e1b24b8834e5f23a028a2a795f3a63906d2d557aeba250be7ff7cfeab1015/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626162796d61726b742f696e666c75786462322d62756e646c65)](https://packagist.org/packages/babymarkt/influxdb2-bundle)[![License](https://camo.githubusercontent.com/c8d2c2c2b1fa5d66f593af33ee6b44d52dce7496c31eb3fe90d8664e40a24135/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f426162792d4d61726b742f696e666c75786462322d62756e646c652e737667)](https://github.com/Baby-Markt/influxdb2-bundle/blob/master/LICENSE)[![PHP from Packagist](https://camo.githubusercontent.com/614c6f2beb5c720ab6c0cdfe4ad9a503c4cc9f72417aaa70f9fb8236cc11c2f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f626162796d61726b742f696e666c75786462322d62756e646c652f312e782d646576)](https://packagist.org/packages/babymarkt/influxdb2-bundle)[![PHP from Packagist](https://camo.githubusercontent.com/57776060da470a6b0f1c0e163c1cf248d94c1c95a77f00795d135fd4384ce057/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f426162792d4d61726b742f696e666c75786462322d62756e646c652f312e78)](https://github.com/Baby-Markt/influxdb2-bundle)

#### Note: Use this symfony bundle with InfluxDB 2.x and InfluxDB 1.8+ ([see details on client repo](https://github.com/influxdata/influxdb-client-php/blob/master/README.md#influxdb-18-api-compatibility)).

[](#note-use-this-symfony-bundle-with-influxdb-2x-and-influxdb-18-see-details-on-client-repo)

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

[](#installation)

You need to require this library through composer:

```
composer require babymarkt/influxdb2-bundle
```

If you are using [Symfony Flex](https://github.com/symfony/flex), the following will happen automatically. Otherwise, you have to enable the bundle on the `bundles.php` manually:

```
// config/bundles.php
return [
    // ...
    Babymarkt\Symfony\Influxdb2Bundle\BabymarktInfluxdb2Bundle::class => ['all' => true],
];
```

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

[](#configuration)

Let's start with a minimal setup:

```
babymarkt_influxdb2:
  client:
    connections:
      default:
        url: https://localhost:8086
        bucket: my-bucket
        org: my-org
```

Or in the short version:

```
babymarkt_influxdb2:
  client:
    url: https://localhost:8086
    bucket: my-bucket
    org: my-org
```

This creates the following services for you:

- a InfluxDb2 Client `babymarkt_influxdb2.default_client`
- a default Write-API `babymarkt_influxdb2.default_write_api`
- and a default Query-API `babymarkt_influxdb2.default_query_api`

Full configuration reference:

```
babymarkt_influxdb2:

  # The clients will be named by connection names.
  client:
    # If not set, the first connection will be taken.
    default_connection: ~
    connections:
      your_client_name:

        # InfluxDB server API url (ex. http://localhost:8086).
        url: ~ # Required

        # Auth token to access your instance.
        token: ~

        # Default destination bucket for writes.
        bucket: ~ # Required

        # Default organization bucket for writes.
        org: ~ # Required

        # Precision for the unix timestamps within the body line-protocol.
        precision: 'ns'

        # Turn on/off SSL certificate verification. Set to `false` to disable certificate verification.
        verifySSL: true

        # Enable verbose logging of http requests.
        debug: false

        # Log output.
        logFile: ~

        # Default tags.
        tags:
          - first-tag
          - second-tag
          #...

        # The number of seconds to wait while trying to connect to a server. Use 0 to wait indefinitely.
        timeout: 10

        # Pass ~ string to specify an HTTP proxy, or an array to specify different proxies for different protocols.
        proxy: ~

        # GuzzleHttp Client options to allow following redirects.
        allow_redirects:
          max: 5
          strict: ~
          referer: ~
          protocols: [ 'http', 'https' ]

  api:
    write:
      # If not set, the first option_set will be taken.
      default_option_set: ~
      option_sets:
        # The Write-API name
        your-optionset-name:
          # The client connection to use for writes. Defaults to the default_connection.
          connection: ~

          # The Write-API options (see https://github.com/influxdata/influxdb-client-php#writing-data)
          options:
            # (writeType) Type of write SYNCHRONOUS / BATCHING.
            write_type: ~

            # (batchSize) The number of data point to collect in batch.
            batch_size: ~

            # (retryInterval) The number of milliseconds to retry unsuccessful write. The retry interval is "exponentially" used when the InfluxDB server does not specify "Retry-After" header.
            retry_interval: ~

            # (jitterInterval) The number of milliseconds before the data is written increased by a random amount.
            jitter_interval: ~

            # (maxRetries) The number of max retries when write fails.
            max_retries: ~

            # (maxRetryDelay) Maximum delay when retrying write in milliseconds.
            max_retry_delay: ~

            # (maxRetryTime) Maximum total retry timeout in milliseconds.
            max_retry_time: ~

            # (exponentialBase) The base for the exponential retry delay.
            exponential_base: ~
```

Service usage
-------------

[](#service-usage)

### Clients

[](#clients)

Default client injection by class name:

```
namespace App;
class GenericMetricsWriter {
    public function __construct(protected \InfluxDB2\Client $client) {
        // ...
    }
}
```

Specific clients can be retrieved by injecting via service definition:

```
services:
  App\GenericMetricsWriter:
    arguments: [ '@babymarkt_influxdb.your_client_name_client' ]
```

or by getting from client registry:

```
namespace App;
use Babymarkt\Symfony\Influxdb2Bundle\Registry\ClientRegistry;
class GenericMetricsWriter {
    public function __construct(protected ClientRegistry $registry) {
        /** @var \InfluxDB2\Client $client */
        $client = $this->registry->getClient('your_client_name');
        // ...
    }
}
```

### APIs

[](#apis)

In the same way, you get the Write- and Query-APIs:

```
namespace App;
class GenericMetricsWriter {
    // Injects the default Write- and Query-API.
    public function __construct(
        protected \InfluxDB2\WriteApi $writeApi,
        protected \InfluxDB2\QueryApi $queryApi) {
        // ...
    }
}
```

Specific APIs can be retrieved by injecting via service definition:

```
services:
  App\GenericMetricsWriter:
    arguments:
      - '@babymarkt_influxdb.your_name_write_api'
      - '@babymarkt_influxdb.your_name_query_api'
```

or by getting from API registry:

```
namespace App;
use Babymarkt\Symfony\Influxdb2Bundle\Registry\ApiRegistry;
class GenericMetricsWriter {
    public function __construct(protected ApiRegistry $registry) {
        /** @var \InfluxDB2\WriteApi $writeAPi */
        $writeAPi = $this->registry->getWriteApi('your_name');
        /** @var \InfluxDB2\QueryApi $queryApi */
        $queryApi = $this->registry->getQueryApi('your_name');
        // ...
    }
}
```

### Additional InfluxDB2 APIs

[](#additional-influxdb2-apis)

The official InfluxDB2 client library provides many additional API services. Although no Symfony services are defined for these, they can be obtained at any time via a client instance and require no further configuration.

Here is an example on the ReadyService that returns the status of a InfluxDB2 instance:

```
namespace App;
use InfluxDB2\Service\ReadyService;
class GenericMetricsWriter {
    public function __construct(protected \InfluxDB2\Client $client) {
        /** @var ReadyService $readyService */
        $readyService = $this->client->createService(ReadyService::class);
        $ready = $readyService->getReady();
        echo $ready->getStatus(); // => "ready"
    }
}
```

For more information, see the [API documentation](https://docs.influxdata.com/influxdb/v2.1/reference/api/) of InfluxDB2.

Console Commands
----------------

[](#console-commands)

This bundle comes with some console commands for managing entities via the InfluxDB2 API. All commands have the option `--client`|`-c` to select the InfluxDB2 client to use.

### `babymarkt_influxdb:setup`

[](#babymarkt_influxdbsetup)

Sets up the initial user, organisation and bucket for a new instance.

```
Options:
  -c, --client[=CLIENT]      The client to use. [default: "default"]
      --user[=USER]          Initial username
      --password[=PASSWORD]  Initial user password
      --org[=ORG]            Initial organisation name
      --token[=TOKEN]        Initial admin token
      --bucket[=BUCKET]      Initial bucket
      --duration[=DURATION]  Initial bucket duration [default: 0]

```

### `babymarkt_influxdb:ping`

[](#babymarkt_influxdbping)

Checks the status and version of an InfluxDB instance.

```
Options:
  -c, --client[=CLIENT]      The client to use. [default: "default"]

```

### `babymarkt_influxdb:ready`

[](#babymarkt_influxdbready)

Get the readiness of an instance at startup.

```
Options:
  -c, --client[=CLIENT]      The client to use. [default: "default"]

```

### `babymarkt_influxdb:buckets:list`

[](#babymarkt_influxdbbucketslist)

Lists all available buckets of an instance.

```
Options:
  -c, --client[=CLIENT]      The client to use. [default: "default"]

```

### `babymarkt_influxdb:buckets:retrieve`

[](#babymarkt_influxdbbucketsretrieve)

Provides all information about a bucket.

```
Arguments:
  bucket                 The bucket name or ID.

Options:
  -c, --client[=CLIENT]  The client to use. [default: "default"]

```

### `babymarkt_influxdb:buckets:create`

[](#babymarkt_influxdbbucketscreate)

Creates a new bucket.

```
Options:
  -c, --client[=CLIENT]            The client to use. [default: "default"]
      --name[=NAME]                The bucket name.
      --description[=DESCRIPTION]  The bucket description.
      --org[=ORG]                  The organization name or id.
      --duration[=DURATION]        The duration in seconds for how long data will be kept in the database. 0 means infinite. [default: 0]
      --schema-type[=SCHEMA-TYPE]  The schema type. Allowed values are "implicit" or "explicit". [default: "implicit"]

```

### `babymarkt_influxdb:buckets:update`

[](#babymarkt_influxdbbucketsupdate)

Updates an existing bucket.

```
Arguments:
  bucket                           The bucket name or ID to update.

Options:
  -c, --client[=CLIENT]            The client to use. [default: "default"]
      --name[=NAME]                The bucket name.
      --description[=DESCRIPTION]  The bucket description.
      --duration[=DURATION]        The duration in seconds for how long data will be kept in the database. 0 means infinite. [default: 0]

```

### `babymarkt_influxdb:buckets:delete`

[](#babymarkt_influxdbbucketsdelete)

Deletes an existing bucket.

```
Arguments:
  bucket                 The bucket name or id.

Options:
  -c, --client[=CLIENT]  The client to use. [default: "default"]

```

### `babymarkt_influxdb:orgs:list`

[](#babymarkt_influxdborgslist)

Lists all available organizations of an instance.

```
Options:
  -c, --client[=CLIENT]      The client to use. [default: "default"]

```

### `babymarkt_influxdb:orgs:retrieve`

[](#babymarkt_influxdborgsretrieve)

Provides all information about an organization.

```
Arguments:
  org                    The organization name or ID.

Options:
  -c, --client[=CLIENT]  The client to use. [default: "default"]

```

### `babymarkt_influxdb:orgs:create`

[](#babymarkt_influxdborgscreate)

Creates a new organization.

```
Options:
  -c, --client[=CLIENT]            The client to use. [default: "default"]
      --name[=NAME]                The organization name.
      --description[=DESCRIPTION]  The organization description.

```

### `babymarkt_influxdb:orgs:update`

[](#babymarkt_influxdborgsupdate)

Updates an existing organization.

```
Arguments:
  org                              The organization name or ID.

Options:
  -c, --client[=CLIENT]            The client to use. [default: "default"]
      --name[=NAME]                The organization name.
      --description[=DESCRIPTION]  The organization description.

```

### `babymarkt_influxdb:orgs:delete`

[](#babymarkt_influxdborgsdelete)

Deletes an existing organization.

```
Arguments:
  org                    The organization name or ID.

Options:
  -c, --client[=CLIENT]  The client to use. [default: "default"]

```

Contributing
------------

[](#contributing)

Bug reports and pull requests are welcome on GitHub at .

License
-------

[](#license)

The bundle is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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

2

Last Release

1574d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/446784?v=4)[Niklas](/maintainers/u-nik)[@u-nik](https://github.com/u-nik)

---

Top Contributors

[![u-nik](https://avatars.githubusercontent.com/u/446784?v=4)](https://github.com/u-nik "u-nik (34 commits)")

---

Tags

influxdb2php8symfony-bundlesymfonyInfluxDB2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/babymarkt-influxdb2-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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