vedatrace / vedatrace-php
VedaTrace SDK for PHP
Requires
- php: >=8.1
- guzzlehttp/guzzle: ^7.0
- illuminate/config: ^10.0|^11.0|^12.0|^13.0
- illuminate/container: ^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
- monolog/monolog: ^3.0
- phpoption/phpoption: ^1.9
- psr/log: ^3.0
- vlucas/phpdotenv: ^5.6
Requires (Dev)
- phpunit/phpunit: ^10.0
README
VedaTrace is a high-performance, PSR-3 compliant logging SDK for PHP. Built with reliability and scalability in mind, it provides seamless logging to the VedaTrace ingestion API with native support for Laravel, automatic data redaction, and intelligent batching.
🚀 Features
- PSR-3 compliant: Fully implements
Psr\Log\LoggerInterface. - Laravel Ready: First-class support via Service Providers, Facades, and Monolog handlers.
- Intelligent Batching: Buffers logs and flushes them in batches to optimize network overhead.
- Data Redaction: Protect sensitive information (passwords, tokens) with configurable JSON path-based masking.
- Multiple Transports: Choose between high-speed
HttpTransportor localConsoleTransportfor development. - Child Loggers: Create nested log contexts for request tracing and scoped metrics.
📦 Installation
Install VedaTrace via Composer:
composer require vedatrace/vedatrace-php
⚡ Quick Start
Basic PHP Usage
The simplest way to start logging is using the vedatrace() global helper:
use function VedaTrace\vedatrace; $logger = vedatrace([ 'apiKey' => 'your-api-key', 'service' => 'billing-api' ]); $logger->info('Processing payment', [ 'order_id' => 12345, 'amount' => 99.99, 'card_number' => '4111********1111' // Redaction will handle sensitive info ]);
Laravel Integration
VedaTrace integrates seamlessly with Laravel's logging stack.
1. Service Provider & Facade
The service provider is automatically discovered. You can use the VedaTrace facade immediately:
use VedaTrace; VedaTrace::error('Something went wrong in the application!');
2. Monolog Channel
Add VedaTrace to your config/logging.php to use it as a standard channel:
'channels' => [ 'vedatrace' => [ 'driver' => 'monolog', 'handler' => VedaTrace\Laravel\VedaTraceHandler::class, 'level' => 'debug', ], ],
🛠️ Configuration
| Option | Env Variable | Default | Description |
|---|---|---|---|
apiKey |
VEDATRACE_API_KEY |
'' |
Your VedaTrace API Key |
service |
VEDATRACE_SERVICE |
'default-php-service' |
Logical service name |
batchSize |
VEDATRACE_BATCH_SIZE |
100 |
Logs per batch |
flushInterval |
VEDATRACE_FLUSH_INTERVAL |
5000 |
Flush interval (ms) |
redaction |
N/A | paths, mask |
Fields to mask |
📖 Documentation
For detailed guides and API reference, visit the docs/ directory:
🛡️ License
The VedaTrace PHP SDK is open-sourced software licensed under the MIT license.
© 2026 VedaTrace Team. All rights reserved.