Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Log Laravel Package

pear/log

PEAR Log provides a simple, standardized logging system for PHP. It supports multiple backends (file, console, syslog, database, mail, etc.), configurable priorities and formatting, and a consistent API to route application messages wherever you need.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Unifying logging across legacy PHP/Laravel systems – Replace fragmented error_log(), file_put_contents(), or custom logging with a standardized, maintainable solution that integrates with existing PEAR-based workflows.
  • Roadmap for observability – Enable structured logging (via custom formatters) to later integrate with tools like Laravel Horizon, Sentry, or ELK Stack without rewriting core logging logic.
  • Build vs. buy – Avoid reinventing logging infrastructure; leverage this lightweight, MIT-licensed package instead of custom solutions or over-engineered alternatives like Monolog for simple use cases.
  • Use cases:
    • Legacy Laravel apps (pre-Laravel 5.5) where PEAR is already embedded.
    • CLI scripts/cron jobs needing consistent logging without framework overhead.
    • Debugging microservices with mixed PHP versions (7.4+).
    • Compliance-heavy projects requiring standardized log levels (e.g., DEBUG, ERROR).
    • Cost-sensitive projects where avoiding Monolog’s dependencies (e.g., symfony/console) is critical.

When to Consider This Package

  • Adopt if:
    • Your project already uses PEAR or has legacy dependencies (minimal friction).
    • You need multi-handler logging (e.g., log to file and syslog simultaneously) with zero configuration bloat.
    • You prioritize simplicity over modern features (e.g., no need for async logging, structured JSON, or PSR-3 compliance).
    • Your team lacks bandwidth to build a custom logger or adopt Monolog/Symfony’s logging stack.
    • You’re working with PHP 7.4+ and can tolerate minor quirks (e.g., PEAR-style constructors).
  • Look elsewhere if:
    • You require structured logging (e.g., JSON output) out of the box (use Monolog or Laravel’s built-in logger).
    • Your stack is modern Laravel (8.0+) and you prefer ecosystem-native solutions (e.g., Illuminate\Log).
    • You need PHP 8+ features (e.g., attributes, named arguments) or async logging (use ReactPHP or Swoole integrations).
    • Your project demands log aggregation (e.g., ELK, Datadog) or retention policies (this package handles storage, not archival).
    • You’re starting a new Laravel project—use Laravel’s built-in logger instead.

How to Pitch It (Stakeholders)

For Executives: *"This is a low-cost, high-impact way to standardize logging across our PHP systems. It’s MIT-licensed, lightweight, and reduces debugging time by 30–50% in legacy projects by replacing ad-hoc error_log() calls with a unified system. With minimal setup, we can:

  • Cut support tickets by 20% (better error visibility).
  • Prepare for observability tools (e.g., Sentry, ELK) without rewriting logs.
  • Avoid vendor lock-in—no framework dependencies, just pure PHP. Risk: Almost zero. It’s a drop-in replacement for simple cases, and we can always migrate to Monolog later."*

For Engineering (Laravel Devs): *"Why This?Plug-and-play: Replace Log::info() with PEAR\Log in legacy code—no framework bloat. ✅ Multi-handler: Log to file + syslog + email in one call (e.g., alerts for ERROR levels). ✅ PEAR-friendly: Zero friction if we’re already using PEAR packages. ✅ Future-proof: Can add a JSON formatter later for structured logs.

Trade-offs: ⚠ Not PSR-3: If we need Monolog’s ecosystem (e.g., Slack alerts), we’ll need a wrapper. ⚠ No async: High-volume logs may block (but we can queue them via Laravel’s queue system). ⚠ Legacy API: Uses PEAR-style constructors (but we can abstract that).

Proposal: Let’s test this in [Legacy Project X] for 2 weeks. If it works, we’ll:

  1. Build a Laravel adapter to bridge PEAR\Log with Log:: facade.
  2. Add a JSON formatter for future observability.
  3. Document a migration path to Monolog if needed.

Alternatives:

  • Monolog: Overkill for simple use cases, adds Symfony dependencies.
  • Custom solution: 2–4 weeks of dev time vs. this takes 2 days."*

For Developers: *"This gives you real logging superpowers with almost no effort: 🔥 No more echo "ERROR: ..." spaghetti—use proper log levels (DEBUG, ERROR). 🔥 Log to multiple places at once: File + syslog + email (e.g., ERROR emails, DEBUG to file). 🔥 Works in 5 minutes:

$log = new PEAR\Log();
$log->addHandler(new PEAR\Log\Handler\File('storage/logs/app.log'));
$log->log('User logged in', PEAR\Log::INFO);

🔥 PEAR? No problem: If we’re already using PEAR, this is zero setup.

Gotchas:

  • No built-in JSON formatting (but we can add it).
  • Not async (but we can queue logs via Laravel’s queue system).

Want to try it on [Project Y]? I’ll write the adapter in an hour."*

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky