1. Go to this page and download the library: Download lordoffreak/elastica-logzio 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/ */
lordoffreak / elastica-logzio example snippets
sh
use LogzIO\LogzIOElasticaClient;
use LogzIO\Transport\LogzIOGuzzle;
$config = [];
$config['transport'] = new LogzIOGuzzle();
$config['transport']->setToken('YOUR_API_KEY');
$config['transport']->setType('record');
$client = new LogzIOElasticaClient($config);
$data = [
'name' => 'Alejandro',
'surname' => 'Tabares',
];
// First parameter is the id of document.
$documents = [
new \Elastica\Document($id, $data)
];
$resp = $client->addDocuments([$documents);
sh
use LogzIO\LogzIOElasticaClient;
use LogzIO\Transport\LogzIOGuzzle;
// Your type.
$type = 'record';
$config = [];
$config['transport'] = new LogzIOGuzzle();
$config['transport']->setToken('YOUR_API_KEY');
$config['transport']->setType($type);
$client = new LogzIOElasticaClient($config);
$options = array(
'index' => 'YOUR_INDEX_NAME',
'type' => $type,
);
$handler = new ElasticSearchHandler($client, $options);
$log = new Logger('application');
$log->pushHandler($handler);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.