orbiit / logger
A high-performance, PSR-3 compliant logging library natively built for PHP 8.5+.
Requires
- php: >=8.5
- psr/log: ^3.0
Requires (Dev)
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^11.0
- vlucas/phpdotenv: ^5.6
README
Modern, secure and type-safe logging for PHP 8.5+ applications.
🇺🇸 English
📌 Overview
Orbiit Logger is a high-performance, PSR-3 compliant logging engine designed for modern PHP 8.5+ applications.
Built from scratch for speed, security, and scalability, it is ideal for:
- Retail environments (POS)
- SaaS platforms
- High-concurrency systems
It includes native recursive data masking, ensuring LGPD/GDPR compliance out of the box.
⚡ Why Orbiit Logger?
Orbiit Logger was built with a modern approach, leveraging the latest PHP features to deliver a clean and efficient logging experience:
-
🔒 Automatic Data Masking
Prevents leaks of sensitive data (CPF, Credit Cards, Passwords) -
🚀 Performance-Oriented Design
Minimal memory footprint with atomic writes (LOCK_EX) -
🧠 Type-Safe by Design
Enums + Readonly properties (PHPStan Level 9) -
🔗 Ecosystem Friendly
Seamless integration with Orbiit Router and any PSR-3 compatible system
🚀 Quick Start
Installation
composer require orbiit/logger
Basic Usage
use Orbiit\Logger\Logger; use Orbiit\Logger\Handlers\FileHandler; use Orbiit\Logger\Enums\Level; // 1. Setup handler $handler = new FileHandler(DIR . '/logs/app.log', Level::DEBUG); // 2. Initialize Logger $logger = new Logger([$handler]); // 3. Log securely $logger->info('New sale processed', [ 'order_id' => '1025', 'customer_cpf' => '123.456.789-00', // Auto-masked 'total' => 250.50 ]);
🔐 Built-in Security (LGPD Ready)
The DataMasker interceptor automatically detects and obfuscates sensitive data.
Protected keys:
password, token, api_key, secret, card_number, cvv, cpf, cnpj, email
🔍 Deep Nesting Support
Sensitive data is masked even inside deep nested arrays or API responses.
🌍 Real World Scenarios
1. SaaS Integration
$router->add('POST', '/api/v1/login', function() use ($logger) { $logger->notice('Login attempt', $_POST); });
2. Retail / POS
try { $payment->process($creditCard); } catch (PaymentException $e) { $logger->error('Payment failed', [ 'reason' => $e->getMessage(), 'card_number' => $creditCard->number, 'terminal_id' => 'PDV-65' ]); }
🏗️ Architecture
- Contracts → Strict interfaces (Handlers & Formatters)
- Enums → RFC 5424 severity levels
- Immutability → Readonly components
⚡ Performance Philosophy
Orbiit Logger was designed with a performance-first mindset:
- Minimal abstraction layers
- Direct file writes using
LOCK_EX - No processor pipeline overhead
- Native PHP 8.5 features (Enums, Readonly)
🧪 Benchmark (Coming Soon)
A reproducible benchmark suite is being prepared.
It will include:
- Comparison with other PSR-3 loggers
- Memory usage analysis
- High concurrency simulation
- Real-world logging scenarios
Stay tuned 🚀
🤝 Contributing
- Fork the project
- Create your branch
- Run PHPStan:
composer stan
- Run tests:
composer test
📄 License
MIT License — see LICENSE
🇧🇷 Português
📌 Visão Geral
O Orbiit Logger é um motor de logs de alta performance, compatível com PSR-3, desenvolvido para aplicações modernas em PHP 8.5+.
Projetado para velocidade, segurança e escalabilidade, é ideal para:
- Ambientes de varejo (PDV)
- Plataformas SaaS
- Sistemas de alta concorrência
Possui mascaramento automático de dados sensíveis, garantindo conformidade com LGPD/GDPR.
⚡ Por que usar o Orbiit Logger?
- 🔒 Mascaramento automático de dados
- 🚀 Alta performance (LOCK_EX)
- 🧠 Tipagem forte (Enums + Readonly)
- 🔗 Integração com Orbiit Router
🚀 Início Rápido
Instalação
composer require orbiit/logger
Uso básico
$logger->info('Venda realizada', [ 'cpf' => '123.456.789-00', // mascarado automaticamente ]);
🔐 Segurança nativa
Protege automaticamente:
password, token, api_key, secret, card_number, cvv, cpf, cnpj, email
🌍 Casos reais
SaaS
$logger->notice('Tentativa de login', $_POST);
PDV
$logger->error('Falha no pagamento', [ 'cartao' => '****' ]);
🏗️ Arquitetura
- Contracts bem definidos
- Enums nativos
- Componentes imutáveis
🤝 Contribuição
composer stan
composer test
📄 Licença
MIT License
Built with 💙 by icordeiro
Designed for modern PHP applications