ReportingCloud PHP Wrapper
, (*1)
This is the official PHP wrapper for DocCloud Web API. It is authored and supported by Byyoursite BV., (*2)
Minimum Requirements
The DocCloud PHP wrapper requires PHP 5.6 or newer. There are two technical reasons for this:, (*3)
-
All versions of PHP prior to PHP 5.6 have reached end-of-life and should thus not be used in a production environment., (*4)
-
The dependencies guzzlehttp/guzzle require PHP 5.6 or newer., (*5)
If your application is running in an older environment, it is highly advisable to update to a more current version of PHP., (*6)
If you are unable or unwilling to update your PHP installation, it is possible to use DocCloud by directly accessing the [Web API] without using this wrapper. In such cases, it is advisable to use the curl extension to make the API calls., (*7)
Install Using Composer
The recommended way to install the DocCloud PHP wrapper in your project is using Composer:, (*8)
composer require byyoursitenl/doccloud:^1.0
After installing, you need to require Composer's autoloader:, (*9)
require 'vendor/autoload.php';
You can then later update the DocCloud PHP wrapper using Composer:, (*10)
composer update
and for best auto-loading performance consequently execute:, (*11)
composer dump-autoload --optimize
Username and Password for Demos and Unit Tests
The DocCloud PHP wrapper ships with a number of sample applications (see directory /demo
) and phpunit tests (see directory /test
). The scripts in each of these directories require a username and password for DocCloud in order to be executed. So that your username and password are not made inadvertently publicly available via a public GIT repository, you will first need to specify them. There are two ways in which you can do this:, (*12)
Using PHP Constants:
define('DOCCLOUD_USERNAME', 'your-username');
define('DOCCLOUD_PASSWORD', 'your-password');
Using Environmental Variables (For Example in .bashrc
or .env
)
export DOCCLOUD_USERNAME='your-username'
export DOCCLOUD_PASSWORD='your-password'
Note, these instructions apply only to the demo scripts and phpunit tests. When you use DocCloud in your application, set credentials in your constructor, using the setApiKey($apiKey)
or the setUsername($username)
and setPassword($password)
methods. For an example, see /demo/instantiation.php
., (*13)