jordanpartridge/laravel-say-logger
Composer 安装命令:
composer require jordanpartridge/laravel-say-logger
包简介
A Laravel package that speaks your log messages using macOS text-to-speech with different voices for different log levels
README 文档
README
Never miss another error again! 🎯
Laravel Say Logger brings audio feedback to your Laravel application by speaking your log messages using macOS text-to-speech. Different voices for different log levels mean you can hear the severity of issues without constantly checking log files.
Perfect for development environments where you want immediate audio feedback about your application's health.
✨ Features
- 🎤 Text-to-Speech Integration - Uses macOS
saycommand - 🎭 Voice Differentiation - Different voices for different log levels
- ⚡ Async Processing - Non-blocking, won't slow down your app
- 🔧 Easy Configuration - Simple config file setup
- 🎛️ Toggle Control - Enable/disable via environment variable
- 🧹 Message Cleanup - Strips HTML tags and normalizes whitespace
- 🛡️ Error Handling - Graceful fallback if speech fails
🚀 Installation
Install via Composer:
composer require jordanpartridge/laravel-say-logger
Publish the configuration file:
php artisan vendor:publish --provider="JordanPartridge\LaravelSayLogger\LaravelSayLoggerServiceProvider" --tag="config"
⚙️ Configuration
Add the say channel to your config/logging.php:
'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['single', 'say'], // Add 'say' here ], // Add the say channel 'say' => [ 'driver' => 'say', ], ],
Configure voices in config/say-logger.php:
return [ 'enabled' => env('SAY_LOGGER_ENABLED', true), 'voices' => [ 'debug' => 'Alex', 'info' => 'Victoria', 'notice' => 'Fred', 'warning' => 'Kathy', 'error' => 'Veena', 'critical' => 'Moira', 'alert' => 'Tessa', 'emergency' => 'Kyoko', ], ];
🎵 Fun Voice Options
Want to make debugging more entertaining? Try these musical and novelty voices:
'voices' => [ 'debug' => 'Bubbles', // Fun bubbly voice 'info' => 'Good News', // Upbeat singing 'notice' => 'Bells', // Musical bells 'warning' => 'Junior', // Kid voice 'error' => 'Cellos', // Singing cellos 'critical' => 'Bad News', // Ominous singing 'alert' => 'Trinoids', // Alien voice 'emergency' => 'Organ', // Dramatic organ ],
Available Voice Categories:
- Musical:
Cellos,Organ,Bells,Good News,Bad News - Novelty:
Boing,Bubbles,Trinoids,Bahh,Whisper - Character:
Junior,Princess,Albert,Kathy - Standard:
Alex,Victoria,Daniel,Samantha
See all available voices: say -v '?'
Test a voice: say -v Cellos "Your error message here"
## 🎭 Voice Examples
| Log Level | Voice | Character |
|-----------|-------|-----------|
| `debug` | Alex | Calm male voice |
| `info` | Victoria | Pleasant female voice |
| `warning` | Kathy | Concerned female voice |
| `error` | Veena | Urgent female voice |
| `critical` | Moira | Serious female voice |
| `emergency` | Kyoko | Alert female voice |
## 🎯 Usage
Once configured, your log messages will be automatically spoken:
```php
// These will be spoken by different voices
Log::debug('Cache cleared successfully'); // Alex
Log::info('User logged in successfully'); // Victoria
Log::warning('Low disk space detected'); // Kathy
Log::error('Database connection failed'); // Veena
Log::critical('Payment processor is down'); // Moira
Log::emergency('Security breach detected'); // Kyoko
Real-World Examples
// Database errors try { DB::connection()->getPdo(); } catch (Exception $e) { Log::error('Database connection failed: ' . $e->getMessage()); // 🔊 Veena: "Database connection failed: SQLSTATE[HY000]..." } // API failures if ($response->failed()) { Log::warning('Payment API is responding slowly'); // 🔊 Kathy: "Payment API is responding slowly" } // System monitoring if (disk_free_space('/') < 1000000) { Log::critical('Disk space critically low'); // 🔊 Moira: "Disk space critically low" }
🎛️ Environment Control
Control the package via environment variables:
# Enable/disable speech SAY_LOGGER_ENABLED=true # Or disable for production SAY_LOGGER_ENABLED=false
🔧 Advanced Configuration
Custom Voice Mapping
You can customize which voice speaks for each log level:
'voices' => [ 'error' => 'Samantha', // Use Samantha for errors 'warning' => 'Daniel', // Use Daniel for warnings 'critical' => 'Fiona', // Use Fiona for critical // ... etc ],
Available macOS Voices
Check available voices on your system:
say -v "?"
Popular voices include: Alex, Victoria, Samantha, Daniel, Fiona, Karen, Moira, Tessa, Veena, Kyoko.
🛡️ Error Handling
The package includes robust error handling:
- Graceful Fallback - If
saycommand fails, logging continues normally - Empty Message Protection - Won't attempt to speak empty messages
- Process Isolation - Speech failures won't affect your application
🎯 Use Cases
Development Environment
- Immediate Error Feedback - Hear problems as they happen
- Hands-Free Debugging - No need to constantly check logs
- Severity Awareness - Know how serious an issue is by the voice
Demo Environments
- Impressive Demonstrations - Show clients real-time error handling
- System Health Monitoring - Audio feedback for system status
Local Testing
- Test Result Feedback - Hear when tests fail
- Performance Monitoring - Audio alerts for slow queries
📋 Requirements
- PHP: ^8.1
- Laravel: ^10.0 || ^11.0
- macOS: Required for
saycommand - Monolog: ^3.0
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This package is open-sourced software licensed under the MIT license.
🎉 Credits
- Jordan Partridge - Creator and maintainer
- Laravel Community - For the amazing framework
- Apple - For the macOS
saycommand
🔮 Future Ideas
- Cross-platform support (Windows SAPI, Linux espeak)
- Rate limiting for repeated messages
- Custom message filtering
- Volume control per log level
- Slack/Discord integration
- Web interface for configuration
Made with ❤️ by Jordan Partridge
Never miss another error again! 🎯
jordanpartridge/laravel-say-logger 适用场景与选型建议
jordanpartridge/laravel-say-logger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 07 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「logging」 「debugging」 「audio」 「laravel」 「text-to-speech」 「say」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jordanpartridge/laravel-say-logger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jordanpartridge/laravel-say-logger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jordanpartridge/laravel-say-logger 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP package that takes a snapshot of your application and allows you to retrieve it later to help with debugging.
A Zend Framework module that sets up Monolog for logging in applications.
Library for manipulating audio files (validating, transcoding, and tagging)
Laravel Database Query Logger and debug helper.
Asynchronous Sentry for Symfony - Fire and forget
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-11