Bundle system. A Laravel-specific wrapper or facade could abstract the Symfony dependencies.influxdata/influxdb-client-php (v2.4+), which is a robust, feature-complete client for InfluxDB 2.x. This ensures compatibility with modern InfluxDB APIs (e.g., Flux queries, Write API batching).influxdata/influxdb-client-php is framework-agnostic and can be used directly in Laravel. The bundle’s configuration and service registration logic can be replicated via Laravel’s config/ files and service providers.Registry, Console commands) would require custom Laravel implementations or facades. The bundle’s babymarkt_influxdb2-bundle namespace would need refactoring.config/influxdb.php could mirror the bundle’s YAML structure, with minimal adjustments for Laravel’s array-based config format.ReadyService) via bindings in a service provider.symfony/console, symfony/yaml). While these are not strictly required for core functionality, they introduce potential version conflicts or unnecessary bloat in a Laravel project.influxdata/influxdb-client-php is actively maintained, reducing risk.influxdata/influxdb-client-php directly in Laravel for core functionality, wrapping only the configuration/service registration logic.batch_size, max_retries) must be tuned.config)? The bundle supports token configuration but lacks explicit guidance on secure storage.spatie/laravel-influxdb) that better fits the stack?influxdata/influxdb-client-php suffice, avoiding Symfony dependencies entirely?influxdata/influxdb-client-php directly in Laravel for the InfluxDB client, Write/Query APIs, and additional services (e.g., ReadyService).config/influxdb.php (array format). Example:
// config/influxdb.php
return [
'connections' => [
'default' => [
'url' => env('INFLUXDB_URL', 'http://localhost:8086'),
'token' => env('INFLUXDB_TOKEN'),
'bucket' => env('INFLUXDB_BUCKET'),
'org' => env('INFLUXDB_ORG'),
'precision' => 'ns',
'timeout' => 10,
],
],
'write_apis' => [
'default' => [
'connection' => 'default',
'options' => [
'write_type' => \InfluxDB2\WritePrecision::NS,
'batch_size' => 1000,
'max_retries' => 3,
],
],
],
];
// app/Providers/InfluxDBServiceProvider.php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use InfluxDB2\Client;
use InfluxDB2\WriteApi;
use InfluxDB2\QueryApi;
class InfluxDBServiceProvider extends ServiceProvider
{
public function register()
{
$this->mergeConfigFrom(__DIR__.'/../../config/influxdb.php', 'influxdb');
$config = $this->app['config']['influxdb'];
foreach ($config['connections'] as $name => $connection) {
$this->app->singleton("influxdb.client.{$name}", function () use ($connection) {
return Client::fromOptions([
'url' => $connection['url'],
'token' => $connection['token'],
]);
});
$this->app->singleton("influxdb.write_api.{$name}", function () use ($name, $config) {
$client = $this->app->make("influxdb.client.{$name}");
$options = $config['write_apis'][$name]['options'] ?? [];
return $client->getWriteApi($options);
});
$this->app->singleton("influxdb.query_api.{$name}", function () use ($name) {
return $this->app->make("influxdb.client.{$name}")->getQueryApi();
});
}
}
}
// app/Console/Commands/InfluxDBPing.php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use InfluxDB2\Service\ReadyService;
class InfluxDBPing extends Command
{
protected $signature = 'influxdb:ping {--client=default}';
protected $description = 'Check InfluxDB instance status';
public function handle()
{
$client = app("influxdb.client.{$this->option('client')}");
$readyService = $client->createService(ReadyService::class);
$status = $readyService->getReady();
$this->info("InfluxDB Status: {$status->getStatus()}");
}
}
influxdata/influxdb-client-php to composer.json.config/influxdb.php and InfluxDBServiceProvider.babymarkt/influxdb2-bundle with custom implementations.symfony/console) may require polyfills or version constraints..env for sensitive data (e.g., INFLUXDB_TOKEN), integrating with the config file.config/influxdb.php and .env.config/app.php.How can I help you explore Laravel packages today?