hamzi/portflow
PortFlow connects serial hardware (thermal printers, barcode/RFID scanners, scales, IoT boards) to Laravel via a driver-based architecture. Parse raw bytes into typed events, queue routes, and printing workflows, with Web Serial API support for browser integration.
New Risks:
PortFlow::webhook('scale') to register endpoints (e.g., POST /api/hardware/scale/webhook).PortFlow\Webhook\ValidatesPayload.php artisan portflow:diagnose scale1 to check connection status.php artisan portflow:flush-buffer printer to clear stuck commands./dev/tty* access.portflow.php:
'buffers' => [
'printer' => [
'enabled' => true,
'storage' => 'database', // or 'redis', 'file'
'ttl' => 3600, // seconds
],
],
| Risk Area | Updated Assessment | Mitigation Strategy |
|---|---|---|
| Webhook Security | Unauthenticated webhook events could trigger malicious actions (e.g., fake sensor data). | Enforce HMAC signatures and IP restrictions on webhook routes. Use PortFlow\Webhook\Middleware. |
| CLI Privileges | Diagnostic tool may fail on restricted environments (e.g., shared hosting). | Document fallback workflows (e.g., manual checks via browser). Use try-catch in CLI commands. |
| Buffer Overhead | Persistent buffers could bloat storage or slow down hardware interactions. | Monitor buffer size with PortFlow::bufferStats(); set TTL-based cleanup. |
| Webhook Latency | Network delays between hardware and Laravel may cause stale events. | Implement event deduplication (e.g., track last-seen timestamps). |
| Firmware Dependency | Webhook driver requires hardware firmware support; not all devices offer this. | Provide fallback drivers (e.g., polling-based) in config/portflow.php. |
PortFlow::oldDriverMethod().)ScaleWeightUpdated → InventoryJob).php artisan portflow:retry-failed).json column type).if (!Device::supportsWebhooks()) {
throw new \PortFlow\Exceptions\UnsupportedFeature("Use polling driver instead.");
}
| Component | Updated Compatibility Notes |
|---|---|
| Laravel | Webhook driver requires Laravel 10.30+ (for new HTTP client features). Check composer.json constraints. |
| PHP | CLI tool may use process management (e.g., proc_open), requiring PHP PCNTL extension on some hosts. |
| Hardware | Webhook driver only works with firmware-supported devices (e.g., Hokuyo laser scanners, some scales). |
| Buffers | Storage backends must support: |
- **Database**: `illuminate/database` package.
- **Redis**: `predis/predis` or `phpredis`.
- **Filesystem**: No additional dependencies. |
| CI/CD | Add tests for:
- Webhook payload validation.
- Buffer persistence (e.g., PortFlow::buffer()->flush()).
- CLI command output (e.g., artisan test --filter=PortFlowCLI). |
composer require hamdyelbatal122/portflow:^0.7.0.php artisan vendor:publish --tag=portflow-config.routes/web.php:
PortFlow::webhook('scale')->to(function (ScaleWebhook $event) {
// Handle event
});
How can I help you explore Laravel packages today?