Product Decisions This Supports
- Debugging & Observability: Enables granular, CLI-driven logging for Laravel/PHP applications, reducing reliance on
var_dump() or scattered log files. Ideal for local development, testing, and debugging workflows where real-time console feedback is critical.
- Developer Experience (DX): Standardizes log verbosity and formatting across CLI tools (Artisan commands, scripts, tests), improving consistency and reducing cognitive load. Verbosity levels (
Quiet to Debug) align with Laravel’s debug modes, enabling seamless integration.
- Build vs. Buy: Justifies adopting this lightweight package over building a custom solution for teams already using PSR-3 loggers (e.g., Monolog). Avoids reinventing wheel for console-specific logging needs.
- Roadmap Priorities:
- Testing Infrastructure: Integrate into CI/CD pipelines to dynamically surface test debug info (e.g.,
--verbose for flaky tests).
- CLI Tooling: Standardize logging across internal tools (e.g., migrations, report generators) with consistent formatting and verbosity controls.
- Observability Stack: Bridge between application logs (Monolog) and console logs for unified debugging in hybrid environments.
- Use Cases:
- Local Development: Replace ad-hoc
dd()/var_dump() with structured console logs during feature development.
- Automated Scripts: Add debug flags to cron jobs or Artisan commands (e.g.,
php artisan migrate --verbose).
- Onboarding: Simplify troubleshooting for junior devs by exposing log levels via intuitive CLI flags.
When to Consider This Package
- Adopt if:
- Your team relies heavily on CLI tools (Artisan, custom scripts, tests) and needs fine-grained log control without switching contexts.
- You’re using PSR-3 loggers (e.g., Monolog) but lack a dedicated console logger for non-web contexts (e.g., queues, cron jobs).
- You want to reduce debugging friction by replacing
var_dump()/dd() with structured, configurable console logs.
- Your stack includes Laravel 9+ (PHP 8.1+) or Symfony Console, and you’re open to MIT-licensed packages with minimal dependencies.
- You prioritize developer productivity over production-grade log aggregation (use Monolog/ELK for the latter).
- Look elsewhere if:
- You need production log aggregation (e.g., centralized logging, alerting) — use Monolog + ELK/Grafana instead.
- Your team prefers GUI-based debugging (e.g., Laravel Telescope) over CLI logs.
- You require structured JSON logging for APIs/microservices — consider
monolog/handler or spatie/laravel-logging.
- The package’s maturity (0 stars, recent release) is a concern — evaluate for short-term needs only (e.g., pilot projects).
- You’re locked into PHP <8.1 or need broader log handler features (e.g., file rotation, syslog).
How to Pitch It (Stakeholders)
For Executives:
*"This package supercharges our CLI debugging workflows by letting developers dynamically control log verbosity with simple flags (e.g., --verbose for tests, --quiet for production-like runs). It’s a lightweight, open-source solution that replaces var_dump() and scattered log files with structured, consistent console output—saving hours in troubleshooting without adding complexity. Think of it as ‘tail -f’ for Laravel, but built into the codebase. MIT-licensed and PSR-3 compliant, so it integrates seamlessly with our existing logging stack.
Ask: Would you prioritize reducing debugging time for CLI tools as part of our Q3 developer experience initiatives?"
For Engineering:
*"Problem: Debugging CLI tools in Laravel often requires mixing var_dump(), log files, and --verbose flags across different tools—leading to inconsistency and noise. For example, troubleshooting a flaky test or migration might involve:
- Scanning log files for errors.
- Adding
dd() calls and committing them.
- Using
--verbose flags inconsistently across tools.
Solution: phrity/logger-console is a PSR-3 console logger that:
- Replaces
dd()/var_dump() with structured, configurable logs (e.g., {datetime} [DEBUG] {message}).
- Supports 5 verbosity levels (
Quiet to Debug) via CLI flags (-v, -vvv), enabling one-command debugging.
- Works alongside Monolog/Symfony Console, so no refactoring is needed.
- Why now? It’s a drop-in replacement for ad-hoc logging in tests/scripts, and the opportunity score (33.55) suggests high potential for DX improvements with minimal effort.
Proposal:
- Pilot in test suites: Replace
echo/var_dump with $logger->debug() in critical tests.
- Add
--verbose support to 2–3 high-impact CLI tools (e.g., php artisan migrate, php artisan queue:work).
- Standardize log formats across the team to reduce onboarding friction.
Risks:
- Low: MIT license, minimal dependencies, and PHP 8.1+ only (aligns with Laravel 9+).
- Mitigations:
- Test thoroughly in staging before full adoption.
- Use as a supplement to Monolog (not a replacement) to avoid log loss.
Ask: Can we allocate 2 dev-hours to test this in our CI/CD scripts next sprint?"
Key Selling Points for Engineers:
- No Context Switching: Debug directly in the terminal without opening log files.
- Consistency: Standardized formats and verbosity across all CLI tools.
- Future-Proof: PSR-3 compliant; integrates with Laravel’s logging stack.
- Zero Lock-In: Easy to replace or extend if needed.