PHP code example of punktde / sentry-flow
1. Go to this page and download the library: Download punktde/sentry-flow 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/ */
punktde / sentry-flow example snippets
declare(strict_types=1);
namespace Vendor\Package\Sentry\Transport;
use Sentry\Event;
use Sentry\Exception\JsonException;
use Sentry\Transport\TransportInterface;
use Sentry\Util\JSON;
class FileWriterTransport implements TransportInterface
{
/**
* @param Event $event
*
* @return string|null Returns the ID of the event or `null` if it failed to be sent
*
* @throws JsonException
*/
public function send(Event $event): ?string
{
if (file_put_contents('My\Path\And\FileName', JSON::encode($event)) !== false) {
return $event->getId();
}
return null;
}
}