- What is alt-three/logger and what does it do?
- Alt Three Logger is a context-aware logging wrapper for Laravel 5 that decorates the framework's PSR-3 logger. It adds fluent helpers such as withContext, withTags, and withUser so log entries can carry user IDs, tags, and custom metadata without repeating that context at every call site. It also provides getLogger() and newLogger() to reach Monolog or create scoped loggers.
- Is alt-three/logger compatible with Laravel 8, 9, 10, or 11?
- No. The package was built for the Laravel 5.0 through 5.5 era, before config/logging.php and native named channels existed. Laravel 5.6 introduced Log::channel(), Log::stack(), and later Log::withContext() and Log::shareContext(), which cover the same use cases. On Laravel 8 and newer, use the native logging APIs instead.
- How do I install alt-three/logger?
- In a Laravel 5.0 through 5.5 application, install it with composer require alt-three/logger. Laravel 5.5 package discovery may register the service provider and Logger facade automatically; on earlier 5.x versions you register them in config/app.php. Verify the exact provider, alias, and version constraints in the repository's composer.json and README before installing.
- How do withContext, withTags, and withUser work?
- withContext attaches custom metadata to a log entry, withTags adds searchable tags, and withUser records the current user ID. They are fluent helpers, so you can chain them before writing a log message. This keeps user IDs, tags, and metadata consistent without repeating the same context at every call site.
- Can native Laravel logging replace alt-three/logger?
- Yes. Laravel 5.6 introduced named channels, Log::channel(), and Log::stack(), and later versions added Log::withContext() and Log::shareContext(). Those native features cover scoped loggers and shared metadata without a wrapper. On Laravel 8 and newer, use native logging and do not add this package.
- How do I migrate from alt-three/logger to Laravel's Log facade?
- Inventory call sites such as Logger::getLogger(), Logger::newLogger('x'), app('logger'), and any type hints on the package class. Map each scoped logger name to a channel in config/logging.php, then introduce a thin app-owned shim with the same method names that delegates to Log::channel() and Log::withContext(). Migrate call sites behind the shim channel by channel, compare log output for parity, and remove the package provider, facade alias, and shim last. Prefer type-hinting Psr\Log\LoggerInterface so the seam stays swappable.
- Is alt-three/logger maintained or safe for production?
- It is archived and unmaintained. There is no CVE triage, no PHP 8 compatibility work, and its passthrough to Monolog internals becomes brittle as Monolog advances. Tolerate it only as a frozen dependency in an existing Laravel 5.x app and open a removal ticket immediately.
- Does alt-three/logger work with PHP 8?
- Most likely not. The package is built for PHP 7 and Illuminate 5.x, and PHP 8 brings dynamic-property deprecations and PSR-3 3.0 Stringable-typed log signatures that can break it. Composer resolution will usually fail on modern Laravel, and forcing it with ignore-platform-reqs does not resolve the Illuminate conflict. Verify composer.json before attempting any migration.
- What are alternatives to alt-three/logger for Laravel logging?
- Use Laravel's native logging: config/logging.php channels, Log::channel(), Log::stack(), Log::withContext(), and Log::shareContext(). For deeper customization, configure a custom Monolog channel or add a context processor. Outside Laravel, use Monolog directly and type-hint Psr\Log\LoggerInterface.
- How should I test code that uses alt-three/logger?
- Type-hint Psr\Log\LoggerInterface rather than the package class so tests can swap in a fake PSR-3 logger. In Laravel, Log::spy() or a custom fake can capture records and assert the context, tags, and user metadata. If legacy call sites use the Logger facade, route them through an app-owned shim and test the shim's delegation to Log::channel() and Log::withContext().