vedatrace/vedatrace-php
最新稳定版本:v1.0.0
Composer 安装命令:
composer require vedatrace/vedatrace-php
包简介
VedaTrace SDK for PHP
README 文档
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.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-02