PHP code example of deliverynetwork / informers-client-php
1. Go to this page and download the library: Download deliverynetwork/informers-client-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
deliverynetwork / informers-client-php example snippets
de_once "<PATH_TO_LIBRARY>/src/FileCache.php";
;
try {
$client = new \informers\client\Client(
array(
'site_id' => <YOUR_SITE_ID>,
'api_key' => '<YOUR_SITE_API_KEY>',
'api_url' => '<PLATFORM_API_URL>',
'cache' => new \informers\client\FileCache(
'<PATH_TO_CACHE_DIRECTORY>',
'<CACHE_PERIOD_IN_SECONDS>'
)
)
);
$currentUrl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";// current page URL
echo $client->render($currentUrl); // rendering informer
} catch (\informers\client\ClientException $e) { /* do something if needed */ }