This is the third major version since the release of the SDK in May 2016.
This version adds support for PHP 8.0 and improves the security and code quality of the SDK.
ReportingCloud PHP SDK 3.0 is fully tested on PHP 8.0.
ReportingCloud PHP SDK 3.0 requires PHP 7.4 or newer in order to be installed.
If you are using an earlier version of PHP, you may continue using using ReportingCloud PHP SDK 2.0, which supports PHP 7.1, or ReportingCloud PHP SDK 1.0, which supports PHP 5.6. Note however, that new backend features will only be added to the most current version of the SDK.
One of most discussed new features of PHP 7.4 was typed properties. ReportingCloud PHP SDK 3.0 now uses typed properties in all classes, resulting in improved security and code quality.
Since migrating to strict types and typed properties, it makes sense to disallow null
in public method signatures.
Consider the following example:
public function mergeDocument(
array $mergeData,
string $returnFormat,
?string $templateName = null,
?string $templateFilename = null,
?bool $append = null,
?array $mergeSettings = null
): array { }
public function mergeDocument(
array $mergeData,
string $returnFormat,
string $templateName = '', /* 3rd parameter */
string $templateFilename = '', /* 4th parameter */
bool $append = false, /* 5th parameter */
array $mergeSettings = [] /* 6th parameter */
): array { }
Here the 3rd, 4th, 5th and 6th parameters have an empty value or false as default and no longer null
.
You will only be affected by this change, if you have explicitly set null
as a default value in your application code. In this case, you will see the following error when running your unit tests:
PHP Fatal error: Uncaught TypeError:
Argument 3 passed to TxTextControl\ReportingCloud\ReportingCloud::mergeDocument()
must be of the type string, null given, called in [..]
All you have to do is replace the null
with the correct value (''
, []
, 0
true
or false
).
The above example shows just the mergeDocument()
method signature, however this change affects all public methods.
At the request of several users – in particular, those those from the Laravel community – the SDK now uses Guzzle 7.0.
The SDK now uses PHPUnit 9.5 for unit tests.
Versions prior to ReportingCloud PHP SDK 3.0 shipped with TxTextControl\ReportingCloud\StatusCode\StatusCode
, which offered an abstraction to HTTP status codes. This class has been removed in favor of the package ctw/ctw-http
. ctw/ctw-http
offers all the functionality of the StatusCode
class.
ReportingCloud PHP SDK 2.0 used three static analysis tools to check the code quality:
ReportingCloud PHP SDK 3.0 uses just PHPStan, with the strict rules enabled.
The backend allows authentication via username and password or API key. The former has been deprecated:
ReportingCloud->username;
ReportingCloud->password;
ReportingCloud->setUsername(string $username): self
ReportingCloud->getUsername(): string
ReportingCloud->setPassword(string $username): self
ReportingCloud->getPassword(): string
All the demos have been updated to use the API key authentication method.
Please update your code to use the API key authentication method in due course.
The above properties and methods are marked with a @deprecated
tag and will be removed in the next major version.
ReportingCloud PHP SDK 3.0 is authored and supported by Text Control GmbH, the manufacturer of the ReportingCloud Web API.
Despite our best efforts to create understandable documentation, demo applications and unit tests, we understand that there are times when you may need some technical assistance.
If you have a question about ReportingCloud or ReportingCloud PHP SDK 3.0, we are here to help you.
Please refer to the Getting Support section of the ReportingCloud documentation to learn more about the support channels at your disposition.