A PHP library that provides a Monolog handler for sending logs to Parseable - a cloud-native log analytics platform.
- 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
- PHP 8.1 or higher
- ext-curl
- Monolog 3.0+
Install via Composer:
composer require senzidee/monolog-parseable-handler<?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]);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) |
$handler = new ParseableHandler(
host: 'https://logs.company.com',
stream: 'api-logs',
username: 'api-user',
password: 'secure-password'
);$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.
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# 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 psalmFor detailed development information, see DEVELOPMENT.md.
We welcome contributions! Please see CONTRIBUTING.md for details on how to contribute to this project.
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Documentation: Parseable Documentation
- Monolog: Monolog Documentation