PHP code example of outsourced / log-sdk
1. Go to this page and download the library: Download outsourced/log-sdk 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/ */
outsourced / log-sdk example snippets
use OutsourcedSdk/HttpOutsourced;
$api = HttpOutsourced::makeWithGuzzle([
'host' => 'https://outsourced.yourdomain.com',
'accessKey' => 'project-access-key'
]);
use OutsourcedSdk/HttpOutsourced;
$api = HttpOutsourced::makeWithGuzzle([
'host' => 'https://outsourced.yourdomain.com',
'accessKey' => 'project-access-key'
]);
$api->logSingle('level', 'message', ['context' => 'any additional values']);
use OutsourcedSdk/HttpOutsourced;
$api = HttpOutsourced::makeWithGuzzle([
'host' => 'https://outsourced.yourdomain.com',
'accessKey' => 'project-access-key'
]);
$api->logBatch([
[
'level' => 'info',
'message' => 'log #1'
], [
'level' => 'error',
'message' => 'log #2',
'context' => [
'custom' => 'custom value'
]
]
]);
use OutsourcedSdk/HttpOutsourced;
$api = HttpOutsourced::makeWithGuzzle([
'host' => 'https://outsourced.yourdomain.com',
'accessKey' => 'project-access-key',
'logging' => [
'context' => [
'environment' => 'production'
]
]
]);
use OutsourcedSdk/HttpOutsourced;
$api = HttpOutsourced::makeWithGuzzle([
'host' => 'https://outsourced.yourdomain.com',
'accessKey' => 'project-access-key'
]);
$api->verifyPermissions('username', ['list', 'of', 'permissions']);
use OutsourcedSdk/HttpOutsourced;
$api = HttpOutsourced::make(new MyClient(), [
'host' => 'https://outsourced.yourdomain.com',
'accessKey' => 'project-access-key'
]);
$api->verifyPermissions('username', ['list', 'of', 'permissions']);