PHP code example of phattarachai / watchtower-core
1. Go to this page and download the library: Download phattarachai/watchtower-core 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/ */
phattarachai / watchtower-core example snippets
use Phattarachai\WatchtowerCore\Ingest\{EventNormalizer, EventPipeline, EventScrubber, EventTruncator};
use Phattarachai\WatchtowerCore\Support\Gzip;
$body = Gzip::decodeBody($rawBody, $contentEncoding, maxBytes: 20 * 1_048_576);
$pipeline = new EventPipeline(
new EventScrubber($headerKeys, $bodyKeys, redactSqlValues: true),
new EventNormalizer($allowedEventFields, $allowedContextKeys),
new EventTruncator(maxEventBytes: 200_000, maxStringBytes: 8_192),
);
$event = $pipeline->prepare($payload); // queue this, not $payload
$fingerprint = $pipeline->fingerprint($event);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.