Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
shell: bash
steps:
- checkout
- run: choco install php --version=7.3.15 --params '"/ThreadSafe /InstallDir:c:\tools\php"'
- run: choco install php --version=7.4.33 --params '"/ThreadSafe /InstallDir:c:\tools\php"'
- run: cp ~/project/.circleci/php.ini /c/tools/php/
- run: /c/tools/php/php.exe -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- run: /c/tools/php/php.exe composer-setup.php
Expand All @@ -157,8 +157,8 @@ jobs:
- checkout
- run: |
mkdir -p tools/php-cs-fixer
composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer:2.18.7
tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --verbose --show-progress=estimating --using-cache=no --diff
composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer:3.95.18
tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --verbose --show-progress=bar --using-cache=no --diff
phpstan:
docker:
- image: *default-php-image
Expand Down Expand Up @@ -201,16 +201,21 @@ workflows:
name: php-8.2
php-image: "cimg/php:8.2"
xdebug-package: "xdebug"
- tests-php:
name: php-8.3
php-image: "cimg/php:8.3"
xdebug-package: "xdebug"
- tests-php:
name: php-8.4
php-image: "cimg/php:8.4"
xdebug-package: "xdebug"
- tests-php:
name: php-8.5
php-image: "cimg/php:8.5"
xdebug-package: "xdebug"
- tests-php:
name: php-7.4-nightly
influxdb-image: "quay.io/influxdb/influxdb:nightly"
- tests-php:
name: php-7.3
php-image: "cimg/php:7.3"
- tests-windows:
name: php-windows
- tests-cURL:
Expand Down
5 changes: 3 additions & 2 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
return PhpCsFixer\Config::create()

return (new PhpCsFixer\Config())
->setFinder(
PhpCsFixer\Finder::create()
->exclude('src/InfluxDB2/Model')
Expand All @@ -8,4 +9,4 @@
->notPath('src/InfluxDB2/ObjectSerializer.php')
->in(__DIR__)
)
;
;
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 3.9.0 [unreleased]

### Features
1. [#178](https://github.com/influxdata/influxdb-client-php/pull/178): Add PHP 7.4 typehints. PHP minimum version is PHP 7.4.

### Bug Fixes
1. [#170](https://github.com/influxdata/influxdb-client-php/pull/170): Fix PHP 8.5 deprecations.
2. [#177](https://github.com/influxdata/influxdb-client-php/pull/177): Fix invalid typehints for Point, add missing typehints for BatchItemKey
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.2-cli AS dev
FROM php:7.4-cli AS dev

COPY --from=composer /usr/bin/composer /usr/bin/

Expand Down
18 changes: 10 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"homepage": "https://www.github.com/influxdata/influxdb-client-php",
"license": "MIT",
"require": {
"php": ">=7.2",
"php": ">=7.4",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
Expand All @@ -16,14 +16,14 @@
"psr/http-client": "^1.0.1"
},
"require-dev": {
"phpunit/phpunit": "^8.5.27",
"phpunit/phpunit": "^9.6.35",
"squizlabs/php_codesniffer": "~4.0",
"guzzlehttp/guzzle": "^7.0.1",
"guzzlehttp/psr7": "^2.0.0",
"phpstan/phpstan": "^1.12.33 || ^2.2.6",
"phpstan/phpstan-deprecation-rules": "^1.2.1 || ^2.0.4",
"phpstan/phpstan-phpunit": "^1.4.2 || ^2.0.18",
"phpstan/phpstan-strict-rules": "^1.6.2 || ^2.0.12"
"guzzlehttp/guzzle": "^7.0.1 || ^8.0.0",
"guzzlehttp/psr7": "^2.0.0 || ^3.0.0",
"phpstan/phpstan": "^2.2.6",
"phpstan/phpstan-deprecation-rules": "^2.0.4",
"phpstan/phpstan-phpunit": "^2.0.18",
"phpstan/phpstan-strict-rules": "^2.0.12"
},
"suggest": {
"ext-sockets": "Required for UDP writer."
Expand All @@ -39,6 +39,8 @@
}
},
"scripts": {
"phpstan": "vendor/bin/phpstan analyse",
"phpstan-baseline": "vendor/bin/phpstan analyse --generate-baseline",
"test": "vendor/bin/phpunit tests",
"test-coverage": "vendor/bin/phpunit tests --log-junit build/junit.xml -v --coverage-html=build/coverage-report"
},
Expand Down
26 changes: 18 additions & 8 deletions examples/BucketManagementExample.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<?php

/**
* Shows how to create, list and delete Buckets
*/

require __DIR__ . '/../vendor/autoload.php';

use InfluxDB2\Client;
use InfluxDB2\Model\Bucket;
use InfluxDB2\Model\BucketRetentionRules;
use InfluxDB2\Model\Buckets;
use InfluxDB2\Model\Organization;
use InfluxDB2\Model\Organizations;
use InfluxDB2\Model\PostBucketRequest;
use InfluxDB2\Service\BucketsService;
use InfluxDB2\Service\OrganizationsService;
Expand All @@ -30,13 +34,15 @@
//
// Function for getting organization ID
//
function findMyOrg($client): ?Organization
function findMyOrg(Client $client): ?Organization
{
/** @var OrganizationsService $orgService */
$orgService = $client->createService(OrganizationsService::class);
$orgs = $orgService->getOrgs()->getOrgs();
foreach ($orgs as $org) {
if ($org->getName() == $client->options["org"]) {
assert($orgService instanceof OrganizationsService);
$orgs = $orgService->getOrgs();
assert($orgs instanceof Organizations);
foreach ($orgs->getOrgs() as $org) {
assert($org instanceof Organization);
if ($org->getName() === $client->options["org"]) {
return $org;
}
}
Expand All @@ -62,9 +68,9 @@ function findMyOrg($client): ?Organization
->setOrgId(findMyOrg($client)->getId());

$respBucket = $bucketsService->postBuckets($bucketRequest);

assert($respBucket instanceof Bucket);
$bucketName = $respBucket->getName();
$bucketId = $respBucket->getID();
$bucketId = $respBucket->getId();
$createdAt = $respBucket->getCreatedAt()->format('Y-m-d H:i:s');

print "ID: $bucketId Created: $createdAt Name: $bucketName was created\n";
Expand All @@ -74,10 +80,12 @@ function findMyOrg($client): ?Organization
//
print "\n\n----------------------------------------- Bucket List -----------------------------------------\n";
$bucketList = $bucketsService->getBuckets();
assert($bucketList instanceof Buckets);

foreach ($bucketList->getBuckets() as $item) {
assert($item instanceof Bucket);
$bucketName = $item->getName();
$bucketId = $item->getID();
$bucketId = $item->getId();
$createdAt = $item->getCreatedAt()->format('Y-m-d H:i:s');

print "ID: $bucketId Created: $createdAt Name: $bucketName \n";
Expand All @@ -88,7 +96,9 @@ function findMyOrg($client): ?Organization
//
print "\n\n----------------------------------------- Bucket delete -----------------------------------------\n";
$bucketList = $bucketsService->getBuckets();
assert($bucketList instanceof Buckets);
foreach ($bucketList->getBuckets() as $item) {
assert($item instanceof Bucket);
$bucketName = $item->getName();
if (strpos($bucketName, 'example-bucket') !== false) {
$createdAt = $item->getCreatedAt()->format('Y-m-d H:i:s');
Expand Down
1 change: 1 addition & 0 deletions examples/DeleteDataExample.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Shows how to delete data from InfluxDB by client
*/
Expand Down
1 change: 1 addition & 0 deletions examples/InfluxDB_18_Example.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Shows how to use forward compatibility APIs from InfluxDB 1.8.
*/
Expand Down
1 change: 1 addition & 0 deletions examples/InvokableScripts.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Show to use Invokable scripts Cloud API to create custom endpoints that query data
*
Expand Down
1 change: 1 addition & 0 deletions examples/ParameterizedQuery.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Shows how to use parameterized queries
*/
Expand Down
14 changes: 12 additions & 2 deletions examples/QueryFromFileExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,17 @@
//
$filename = "query.flux";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
if (!is_resource($handle)) {
throw new Exception("Unable to open file $filename");
}
$fileSize = filesize($filename);
if ($fileSize === false) {
throw new Exception("Unable to get file size of $filename");
}
$contents = fread($handle, $fileSize);
if ($contents === false) {
throw new Exception("Unable to read file $filename");
}
fclose($handle);

$result = $queryApi->query($contents);
Expand All @@ -74,7 +84,7 @@

function getDayName(int $weekDay): string
{
switch ($weekDay) {
switch ((string) $weekDay) {
case "1":
return "Monday";
case "2":
Expand Down
1 change: 1 addition & 0 deletions examples/WriteBatchingExample.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Shows how to use batching for more performance writes.
*/
Expand Down
2 changes: 1 addition & 1 deletion examples/WriteExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//
// Function for checking results
//
function checkResult(string $filterName, Client $client, string $comment)
function checkResult(string $filterName, Client $client, string $comment): void
{
$query = "from(bucket: \"my-bucket\")
|> range(start: 0)
Expand Down
2 changes: 1 addition & 1 deletion examples/WriteUDPExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
print "$measurement: Temperature in $location at $dateTime is $temperature °C\n";
}
}
} catch (Exception|Throwable $e) {
} catch (Throwable $e) {
print "\n\n $e \n\n";
}

Expand Down
Loading
Loading