clue/ami-react
Async Asterisk Manager Interface (AMI) client built on ReactPHP. Connect over TCP, send actions like Originate or CoreShowChannels, and handle responses and events asynchronously via promises, with a simple event-driven API for monitoring calls and channels in real time.
Architecture fit — poor-to-conditional. clue/ami-react is a ReactPHP client, meaning it operates on an event loop with non-blocking streams. Laravel's default execution model is synchronous, per-request, and lifecycle-scoped, so this library cannot be consumed from a controller, job, or middleware without either blocking the loop or being reduced to a thin synchronous wrapper that defeats its purpose. It only fits where a long-running PHP process is acceptable: a dedicated Artisan daemon under Supervisor/systemd, a standalone worker container, or a sidecar. Treat it as infrastructure, not as an application dependency.
Integration feasibility — viable with deliberate boundaries. The realistic pattern is a single long-lived process that authenticates to Asterisk's AMI (TCP 5038, optionally TLS), maintains the event stream, and bridges events into Laravel through Redis pub/sub, a queue, or internal HTTP. Laravel then handles persistence, policy, and UI against a normal request/response flow. This keeps async complexity confined to one deployable unit and lets the rest of the team stay in familiar territory.
Technical risk — moderate, and mostly not about the code. Several factors:
Key questions for the vendor/stakeholder:
Stack fit. Composer-installable, MIT-licensed, PHP 8.x with ReactPHP transitive dependencies (react/socket, react/stream, evenement). It composes cleanly with a Laravel 10/11 codebase as a library, but the runtime should be a separate process or container sharing the same repository — not the web tier. Package it internally as a small domain module (app/Ami or a private Composer package) exposing an event DTO layer and a publisher, so application code never touches ReactPHP types.
Migration path. Greenfield — there is no incumbent to migrate away from, which is an advantage. The migration risk is organizational rather than technical: introducing a daemon deployment unit and an async ownership boundary into a conventionally synchronous Laravel shop. Mitigate by keeping the daemon small, single-purpose, and stateless apart from the connection.
Compatibility. Verify PHP version constraints against the host application, confirm no event-loop package conflicts (revolt/event-loop vs. legacy react/event-loop), and validate Composer resolution against the full Laravel dependency set before committing. Confirm the AMI target (Asterisk 16/18/20/21) and which events are actually emitted — the library transports events, it does not normalize them. TLS support depends on the underlying socket layer and the PBX's certificate posture.
Sequencing.
Maintenance. Low upstream velocity is a double-edged sword: fewer breaking changes, but also a thin maintainer bench and no guaranteed security response. Pin to an exact version, mirror the repository internally, and budget a designated owner with a documented fork-and-patch path. Budget roughly 10–15% of one engineer's time for ongoing stewardship.
Support. Community-only. There is no vendor SLA, no paid support tier, and no Laravel-ecosystem precedent to lean on for answers. Internal runbooks and a clear escalation path are mandatory before go-live. Expect troubleshooting to require reading the library source.
Scaling. One TCP connection per AMI account, and Asterisk's AMI has practical connection limits — horizontal scaling means either provisioning multiple AMI accounts or introducing a single ingestion tier that fans out to consumers. The event loop is single-threaded, so throughput is bounded by per-event handler cost; keep handlers trivial (serialize and publish) rather than doing work inline. Long-running PHP processes are memory-sensitive — enforce periodic graceful recycling and monitor RSS.
Failure modes to design for explicitly:
Ping with timeout.Ramp-up. A mid-level PHP engineer unfamiliar with async patterns needs roughly two to three weeks to be productive in this codebase, and one to two sprints to reach production-hardened. The learning curve is ReactPHP's mental model, not the AMI protocol. Plan for pairing or a spike-driven knowledge transfer, and require the daemon's runbook to be written by the implementer, not after handover. Given 84 stars and unknown repository provenance, add an explicit adoption decision gate after the spike — the fallback of shelling out to an AMI-capable sidecar in another language should remain on the table.
How can I help you explore Laravel packages today?