Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Net Mqtt Laravel Package

binsoul/net-mqtt

A lightweight PHP MQTT client for connecting to MQTT brokers, publishing messages, and subscribing to topics. Supports QoS levels, retained messages, clean sessions, keepalive, and configurable client options for IoT and real-time PHP applications.

Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • binsoul/net-mqtt is a pure-PHP MQTT 3.1/3.1.1 client library, not a broker. It fits Laravel only as an outbound edge: publishing telemetry/events to a broker (Mosquitto, EMQX, HiveMQ, AWS IoT Core) or a long-running subscriber worker consuming commands.
  • It is synchronous/blocking and has no Laravel service provider, facade, config, or queue integration. Expect to build a thin adapter (config + provider + client wrapper) to make it idiomatic.
  • Poor fit for request/response web traffic under php-fpm (per-request connect/handshake overhead). Good fit inside queued jobs and dedicated artisan daemon processes.
  • No MQTT 5.0 support (no shared subscriptions, message expiry, reason codes, user properties). Acceptable if the broker and roadmap stay on 3.1.1.

Integration feasibility

  • Composer-installable, MIT-licensed, PSR-4 autoloadable; integration is a day-scale spike, not a multi-week effort.
  • Must verify PHP 8.1/8.2/8.3 compatibility empirically — the project is low-activity and shows deprecation risk; run it through CI with E_ALL and static analysis before committing.
  • TLS support depends on the underlying stream context; confirm certificate verification, SNI, and client-cert auth paths before any production use.
  • No framework coupling is actually a plus for portability, but it means all ergonomics (connection lifecycle, reconnect, logging, metrics) are our responsibility.

Technical risk

  • Abandonment risk is the dominant concern. 28 stars, single-maintainer signals, and a release date that reads implausibly (2026-01-20) suggest either a metadata artifact or a dormant project. Assume we may need to fork and own it.
  • Blocking I/O means a hung broker can stall a queue worker; every call needs hard timeouts and supervision.
  • No built-in reconnect/backoff, keepalive recovery, or connection pooling — reliability is our code, not theirs.
  • Security surface: credential handling, TLS enforcement, and topic ACLs must be validated by us; the library will not enforce them.
  • QoS semantics (at-most-once / at-least-once, possible duplicates) must be designed for in consumers — idempotency is an application concern.

Key questions

  1. Is our requirement publish-only, subscribe-only, or bidirectional? (Determines whether blocking I/O is a problem at all.)
  2. Which broker and which MQTT version will it speak for the next 24 months? Does 5.0 matter?
  3. What are the throughput, latency, and delivery-guarantee targets (QoS level, at-least-once vs exactly-once expectations)?
  4. Is TLS with mutual auth mandatory? Does this library's stream layer satisfy our security review?
  5. Who owns the fork if upstream goes dark, and what is the acceptable time-to-patch for a CVE?
  6. Have we benchmarked php-mqtt/client or simps/mqtt as fallbacks so the decision is comparative, not single-source?

Integration Approach

Stack fit

  • Wrap the library behind a first-party MqttClientInterface so the vendor is an implementation detail. This is the single highest-leverage decision: it converts an abandonment risk into a swap cost.
  • Add config/mqtt.php (host, port, TLS context, client ID, credentials, keepalive, timeouts, default QoS) and a MqttServiceProvider binding the interface to a BinsoulMqttAdapter.
  • Publish path: enqueue a PublishMqttMessage job; the job resolves the adapter, connects, publishes, disconnects. This aligns with Laravel's queue/retry semantics and avoids connection state in HTTP workers.
  • Subscribe path: a dedicated artisan mqtt:subscribe command under Supervisor/systemd, not under php-fpm. Add graceful shutdown, heartbeat logging, and a health endpoint that reflects last-message-received age.

Migration path

  1. Spike (1–2 days): connect to a local Mosquitto, publish and subscribe on 3.1.1, confirm TLS and PHP-version compatibility.
  2. Abstraction: land the interface, config, provider, and a fake adapter for tests. No feature code touches the vendor namespace directly.
  3. Publish MVP: route one low-risk event stream (e.g., audit or telemetry) through a queued job. Measure connect latency and failure rate.
  4. Subscribe worker: add the daemon command with reconnect/backoff and poison-message handling; run in staging against a real broker.
  5. Observability & rollout: metrics (publish latency, failures, reconnect count, queue depth), alerts, then expand topic coverage.

Compatibility

  • Brokers: Mosquitto, EMQX, HiveMQ, VerneMQ, AWS IoT Core are all fine on 3.1.1; confirm auth mechanism (username/password vs token vs mTLS) matches what the library can carry.
  • PHP: pin a tested minor version in CI; treat any PHP upgrade as requiring re-validation of this dependency until proven otherwise.
  • Laravel: no first-party constraint, so it will "work" on any modern version but without versioned guarantees — document the tested matrix ourselves.

Sequencing

  • Do the abstraction and the adapter in the same PR so there is never a window where feature code calls the vendor directly.
  • Ship publish before subscribe: publish is stateless and low-blast-radius; subscribe introduces long-lived processes and reconnect complexity.
  • Gate production on the fallback library being spike-tested too, so the interface is validated by two implementations.

Operational Impact

Maintenance

  • Expect to own the dependency. Budget a named maintainer, a fork in our org, and a quarterly review of upstream commits. Pin the version and avoid ^ ranges.
  • Keep the adapter thin (~200–400 LOC) so fork maintenance is tractable. Reject any temptation to patch the vendor inline.

Support

  • Community-only support; no SLA, no vendor channel, sparse docs. Internal runbooks and a known-issues page are mandatory before go-live.
  • Escalation path must terminate at our own fork; do not design an operating model that assumes upstream responsiveness.

Scaling

  • Connections are expensive and per-process. Scale horizontally via queue workers, not by multiplexing connections.
  • Publish throughput is bounded by blocking round-trips; batch where the broker and semantics allow, and load-test against the target broker rather than assuming.
  • Subscriber workers scale by partition/topic and consumer group semantics (which 3.1.1 supports only via broker-side features, not client-side shared subscriptions).

Failure modes

  • Broker down or network partition → blocking call until timeout; require connect/read/write timeouts and let the queue retry with backoff.
  • Silent connection death → keepalive/PINGREQ handling must be verified; assume the library does the minimum and add a watchdog that forces reconnect after N missed heartbeats.
  • Message loss (QoS 0) or duplicates (QoS 1) → design consumers to be idempotent; never assume exactly-once.
  • TLS/cert expiry → alert on certificate expiry independently of the library.
  • Long-running subscriber memory growth → recycle the worker on a max-message or max-runtime threshold.
  • Version drift/abandonment → the interface swap is the mitigation; rehearse it once.

Ramp-up

  • Low for publish (an afternoon for a Laravel developer familiar with queues); moderate for subscribe (requires MQTT fundamentals: QoS, clean session, keepalive, retained messages, topic wildcards).
  • Invest in a half-day internal session and a reference implementation; the package's sparse docs shift the learning burden onto us.
  • Onboarding cost is dominated by operational knowledge (broker topology, reconnect behavior), not by the library's API.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core