phrity/net-stream
PSR-7 StreamInterface and PSR-17 StreamFactory implementations built for socket-based I/O. Includes Stream, SocketStream, SocketClient/Server, context wrapper, stream collections, and stream-specific exceptions and utilities for network connections.
StreamCollection supports batch operations for high-throughput scenarios (e.g., file transfers, distributed logging).SocketClient/SocketServer.StreamedResponse) for hybrid HTTP/socket endpoints.Context listeners for cross-cutting concerns (auth, retries).StreamCollection.Adopt When:
Context.Look Elsewhere If:
beberlei/ratchet or react/websocket instead).openssl or paragonie/sodium)."This package lets us standardize socket communication in Laravel—cutting dev time by 30% for real-time features like live dashboards or IoT integrations. It’s PSR-compliant (industry standard), lightweight, and future-proofs our architecture for async workloads. For example, we can now build a scalable chat backend or legacy system bridge without custom socket code, reducing technical debt. The MIT license and active maintenance make it a low-risk choice."
*"phrity/net-stream gives us:
StreamCollection manages hundreds of connections efficiently (e.g., for WebSocket gateways).stream_socket_client calls with this—it’s safer, more maintainable, and adds features like persistent connections we’ve been missing."**"This package fills a gap in Laravel’s ecosystem for low-level socket abstractions. Key advantages:
Context listeners enable hooks for monitoring, retries, or security.StreamCollection reduce overhead.
Recommendation: Adopt for internal tools (e.g., CLI-based socket servers) or real-time features where we need to avoid HTTP overhead. Pair with ReactPHP for async scaling if needed."**"The package’s PSR compliance and event listeners simplify testing and observability:
Mockery.StreamException integrates with Laravel’s error handlers (e.g., Sentry).closeRead()/closeWrite() methods prevent leaks.
Risk: Ensure Laravel’s service container binds streams as singletons or scoped instances to avoid memory issues."*How can I help you explore Laravel packages today?