dennisvanbeersel/symfony-logger-client
symfony/http-client, symfony/options-resolver) to integrate core functionality.LoggerInterface with Laravel’s Psr\Log\LoggerInterface via a wrapper.symfony/dependency-injection conflicts).Logger, Laravel’s Monolog may need custom handlers to bridge the gap.array context in logs; does this package parse it correctly?)| Component | Fit Level | Notes |
|---|---|---|
| Symfony Bundle | ❌ Poor | Laravel does not natively support Symfony bundles. |
| Monolog Integration | ⚠️ Medium | Possible via custom handler, but requires effort. |
| HTTP API Client | ✅ Good | Fallback: Send logs via Laravel’s HTTP client. |
| JavaScript SDK | ✅ Good | Works independently if frontend is separate. |
| PSR-15 Middleware | ⚠️ Medium | Could intercept logs if using a middleware-based approach. |
Option 1: Monolog Handler (Recommended if API supports it)
use Monolog\Handler\AbstractProcessingHandler;
use Symfony\Component\HttpClient\HttpClient;
class AppLoggerHandler extends AbstractProcessingHandler {
public function __construct() {
parent::__construct(HttpClient::create()->request(...));
}
protected function write(array $record): void {
// Forward to API
}
}
config/logging.php:
'channels' => [
'app_logger' => [
'handlers' => ['app_logger_handler'],
],
],
Option 2: Symfony Bridge (If Using Symfony Components)
symfony/dependency-injection and symfony/http-client.Option 3: Direct API Calls (Lowest Coupling)
Http facade to POST logs to the API.use Illuminate\Support\Facades\Http;
Http::post('https://applogger.eu/your-project-uuid/log', [
'message' => $log['message'],
'context' => $log['context'],
'level' => $log['level'],
]);
array (Laravel’s default)..env + YAML setup is straightforward.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| API Unavailable | Logs lost | Local queue + retry logic |
| Rate Limiting | Logs dropped | Exponential backoff |
| Authentication Failure | No logs sent | Monitor API key rotation |
| Schema Changes (API) | Logs malformed | Schema validation layer |
| PHP Process Crashes | Unsent logs in memory | Persist logs to disk first |
| Frontend JS SDK Fails | Client-side errors missed | Fallback to server logs |
How can I help you explore Laravel packages today?