event-engine/php-logger
Event Engine Logger for PHP: a lightweight logging package designed to integrate with Event Engine applications. Provides simple logger setup for capturing and routing application events and messages in your PHP services.
## Technical Evaluation
### **Architecture Fit**
- **Structured Logging Alignment**: The package remains aligned with **Event Engine’s event-driven architecture**, maintaining compatibility with **microservices, event sourcing, and observability stacks** (ELK, Datadog, OpenTelemetry). No changes to core architectural fit.
- **Laravel Synergy**: Continues to support **structured, event-centric logging** as an alternative/extension to Laravel’s monolithic `Log` facade. No functional deviations detected.
- **PHP Engine Utils Dependency**: New dependency on **PHP Engine Utils 1.0** suggests:
- Potential **abstraction layer** for shared utilities (e.g., serialization, validation) between Event Engine’s PHP SDK and this logger.
- May introduce **consistent behavior** across Event Engine’s PHP ecosystem but adds minor complexity.
### **Integration Feasibility**
- **PSR-3 Compliance**: No changes; still requires confirmation of `Psr\Log\LoggerInterface` support.
- **Service Provider**: Unchanged; custom provider still needed for Laravel integration.
- **PHP Engine Utils Impact**:
- **Pros**: Reduced code duplication if utils handle common tasks (e.g., payload validation).
- **Cons**: Adds **indirect dependency** on `php-engine-utils`. Verify:
- Composer compatibility (`composer require event-engine/php-engine-utils`).
- No breaking changes in utils that affect logging (e.g., schema validation).
- **PHP 8.4 Deprecation Fixes**: Resolves potential runtime warnings but confirms **PHP 8.4 support is dropped** (aligns with Laravel’s LTS support).
### **Technical Risk**
| Risk Area | Updated Mitigation Strategy |
|-------------------------|---------------------------------------------------------------------------------------------|
| **Vendor Lock-in** | Evaluate `php-engine-utils` for shared abstractions; assess if it introduces Event Engine-specific constraints. |
| **Dependency Bloat** | Monitor `php-engine-utils` for bloat or unused features; consider forking if needed. |
| **PHP Version** | Confirm Laravel app’s PHP version (8.2/8.3) is compatible; test with `php-engine-utils`. |
| **Schema Validation** | If `php-engine-utils` enforces new validation rules, update Laravel’s log formatting. |
### **Key Questions**
1. **PHP Engine Utils Scope**: What utilities does it provide? Does it affect log payload structure or validation?
2. **Backward Compatibility**: Are there breaking changes in `php-engine-utils` that impact existing Laravel integrations?
3. **PHP 8.4+ Support**: Does this release drop support for PHP 8.4? If so, does Laravel’s ecosystem align?
4. **Performance Impact**: Does `php-engine-utils` add overhead to log serialization/validation?
5. **Testing Coverage**: Are there tests for `php-engine-utils` integration in this package?
---
## Integration Approach
### **Stack Fit**
- **Updated Considerations**:
- **Pros**: `php-engine-utils` may simplify **cross-service logging** if other Event Engine clients use the same utils.
- **Cons**: Adds complexity for teams not using Event Engine’s broader ecosystem.
- **Best For**: Unchanged (event-driven Laravel apps, observability-heavy projects).
- **Less Ideal For**: Unchanged (simple CRUD apps, high-I/O scenarios).
### **Migration Path**
1. **Pilot Phase**:
- Add `php-engine-utils` to `composer.json`:
```bash
composer require event-engine/php-engine-utils
```
- Test with a subset of logs to validate utils integration.
2. **Full Rollout**:
- Update `config/event-engine.php` to include utils-specific settings (if any).
- Rebind the logger to ensure utils are initialized:
```php
$this->app->bind(\Psr\Log\LoggerInterface::class, function ($app) {
return new EventEngineLogger(config('event-engine'), new \EventEngine\Utils());
});
```
3. **Fallback**: Unchanged (circuit breaker to Laravel’s default logger).
### **Compatibility**
- **PHP Engine Utils**:
- Verify `composer.json` constraints (e.g., `^1.0`).
- Test with Laravel’s autoloader for class collisions.
- **Laravel Versions**: Unchanged (test against 10.x/11.x).
- **Monolog Conflicts**: Unchanged (monitor for utils-related conflicts).
### **Sequencing**
1. **Add Dependency**:
- Install `php-engine-utils` via Composer.
2. **Update Logger Initialization**:
- Pass utils instance to `EventEngineLogger`.
3. **Test**:
- Validate logs still reach Event Engine with expected structure.
- Check for warnings/errors from utils (e.g., deprecations).
4. **Monitor**:
- Watch for utils-related performance regressions.
---
## Operational Impact
### **Maintenance**
- **New Dependency**:
- Monitor `php-engine-utils` for updates/breaking changes.
- Document utils-specific configurations (e.g., serialization format).
- **Schema/Validation**:
- If utils enforce new rules, update Laravel’s log formatting (e.g., add required fields).
- **Deprecation Warnings**:
- PHP 8.4 deprecation notices are resolved; ensure no new warnings emerge.
### **Support**
- **Debugging**:
- Logs may now include utils-specific metadata; update debugging guides.
- Add utils version to log context for troubleshooting:
```php
Log::withContext(['utils_version' => \EventEngine\Utils::VERSION]);
```
- **SLA Impact**: Unchanged (utils should not affect Event Engine API reliability).
### **Scaling**
- **Horizontal Scaling**: Unchanged (queue workers remain the bottleneck).
- **Vertical Scaling**: Unchanged (utils overhead should be minimal; test under load).
- **Cold Starts**: Unchanged (utils initialization should be fast).
### **Failure Modes**
| Scenario | Updated Mitigation |
|------------------------------|-----------------------------------------------------------------------------------|
| `php-engine-utils` Failure | Add retry logic for utils initialization; fallback to raw logger if critical. |
| Schema Rejection | Validate logs against utils’ rules before submission; alert on repeated failures. |
| PHP Version Mismatch | Pin `php-engine-utils` to a compatible version in `composer.json`. |
### **Ramp-Up**
- **Onboarding**:
- **Documentation Update**: Add `php-engine-utils` to setup instructions.
- Example:
```markdown
## Requirements
- PHP 8.2–8.3 (PHP 8.4+ may introduce warnings)
- `event-engine/php-engine-utils:^1.0`
```
- **Examples**: Update `LoggerServiceProvider` to include utils initialization.
- **Training**:
- Demo utils-specific features (e.g., payload validation).
- Highlight potential pitfalls (e.g., unsupported PHP versions).
- **Adoption Metrics**: Unchanged (track log volume and support ticket trends).
NO_UPDATE_NEEDED would not apply here due to the introduction of php-engine-utils and PHP 8.4 deprecation fixes, which warrant updates to Technical Risk, Integration Approach, and Operational Impact sections.
How can I help you explore Laravel packages today?