senzidee/monolog-parseable-handler
Composer 安装命令:
composer require senzidee/monolog-parseable-handler
包简介
Monolog Handler for send logs to parseable in json through http
README 文档
README
A PHP library that provides a Monolog handler for sending logs to Parseable - a cloud-native log analytics platform.
Features
- Clean Architecture: Built with dependency injection and hexagonal architecture principles
- PSR-3 Compliant: Fully compatible with PSR-3 logging standards through Monolog
- Batch Processing: Supports both individual and batch log processing
- Configurable: Flexible configuration for different Parseable instances
- Type Safe: Full PHP 8.1+ type declarations with Psalm static analysis
- Testable: Comprehensive test suite with mocked dependencies
Requirements
- PHP 8.1 or higher
- ext-curl
- Monolog 3.0+
Installation
Install via Composer:
composer require senzidee/monolog-parseable-handler
Quick Start
<?php use Monolog\Logger; use SenzaIdee\Handler\ParseableHandler; // Create the handler $handler = new ParseableHandler( host: 'https://your-parseable-instance.com', stream: 'application-logs', username: 'your-username', password: 'your-password', port: 8000 ); // Create logger and add handler $logger = new Logger('app'); $logger->pushHandler($handler); // Start logging $logger->info('Application started'); $logger->error('Something went wrong', ['error_code' => 500]);
Configuration
Constructor Parameters
The ParseableHandler constructor accepts the following parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
host |
string |
Yes | - | Parseable server hostname (without trailing slash) |
stream |
string |
Yes | - | Target log stream name |
username |
string |
Yes | - | Authentication username |
password |
string |
Yes | - | Authentication password |
port |
int |
No | 8000 |
Parseable server port |
level |
Level|int|string |
No | Level::Debug |
Minimum log level to handle |
bubble |
bool |
No | true |
Whether to bubble logs to next handler |
httpClient |
HttpClientInterface |
No | null |
Custom HTTP client (uses cURL by default) |
Example Configurations
Basic Configuration
$handler = new ParseableHandler( host: 'https://logs.company.com', stream: 'api-logs', username: 'api-user', password: 'secure-password' );
Production Configuration
$handler = new ParseableHandler( host: 'https://prod-logs.company.com', stream: 'production-app', username: $_ENV['PARSEABLE_USERNAME'], password: $_ENV['PARSEABLE_PASSWORD'], port: 443, level: Level::Warning, // Only log warnings and above bubble: false );
For more advanced usage examples, see USAGE.md.
Development
Local Development with Docker
If you don't have PHP installed locally, use the provided Docker setup:
# Build the development container docker build -t parseable-handler-dev . # Run commands in container docker run --rm -v $(pwd):/app parseable-handler-dev composer install docker run --rm -v $(pwd):/app parseable-handler-dev composer test
Available Commands
# Install dependencies composer install # Run tests composer test # Fix code style composer cs-fixer # Run static analysis composer psalm # All quality checks composer test && composer cs-fixer && composer psalm
For detailed development information, see DEVELOPMENT.md.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details on how to contribute to this project.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- Issues: GitHub Issues
- Documentation: Parseable Documentation
- Monolog: Monolog Documentation
Related Projects
senzidee/monolog-parseable-handler 适用场景与选型建议
senzidee/monolog-parseable-handler 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 446 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 06 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「log」 「logging」 「psr-3」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 senzidee/monolog-parseable-handler 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 senzidee/monolog-parseable-handler 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 senzidee/monolog-parseable-handler 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Zend Framework module that sets up Monolog for logging in applications.
PSR-3 compatible logger with dynamic file naming and hourly rotation, powered by Monolog
Chronolog is a tool that allows you to send logs to files, sockets, mailboxes, databases, etc.
Asynchronous Sentry for Symfony - Fire and forget
Wide logging implementation for PHP - one comprehensive, context-rich event per request
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
统计信息
- 总下载量: 446
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-09