PHP code example of inoovum / log-throwable
1. Go to this page and download the library: Download inoovum/log-throwable 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/ */
inoovum / log-throwable example snippets
injectablephp
namespace Inoovum\Log\Throwable\Log;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Neos\Flow\Annotations as Flow;
class SlackMessage implements ThrowableInterface
{
/**
* @param string $errorInfo
* @param array $options
* @return void
* @throws GuzzleException
*/
public function throwError(string $errorInfo, array $options): void
{
$client = new Client();
$url = $options['webhookUri'];
$client->post($url, [
'headers' => [
'Content-Type' => 'application/json',
],
'json' => [
'text' => $errorInfo
]
]);
}
}