1. Go to this page and download the library: Download anexia-it/php-cloudlog 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/ */
anexia-it / php-cloudlog example snippets
use CloudLog\Client;
// Init CloudLog client
$client = Client::create("index","ca.pem","cert.pem","cert.key");
// Alternative CloudLog client (http)
$client = Client::createHttp("index","token");
// Push simple message
$client->pushEvent("message");
// Push document (multiple formats supported: object, assoc array, json string)
// object
class Event {
public $timestamp;
public $user;
public $message;
public $severity;
}
$event = new Event();
$event->timestamp = 1495024205123;
$event->user = "test";
$event->severity = 1;
$event->message = "My first CloudLog event";
$client->pushEvent($event);
// associative array
$client->pushEvent([
"timestamp" => 1495024205123,
"user" => "test",
"severity" => 1,
"message" => "My first CloudLog event"
]);
// json string
$client->pushEvent('{
"timestamp": 1495024205123,
"user": "test",
"severity": 1,
"message": "My first CloudLog event"
}');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.