Weave Code
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

Socket Laravel Package

amphp/socket

Non-blocking, event-driven socket library for PHP using Amp. Provides async TCP/UDP sockets, client/server connections, DNS and TLS support, timeouts, cancellation, and backpressure-friendly streams—ideal for high-concurrency network services and daemons.

View on GitHub
Deep Wiki
Context7
v2.3.1

What's Changed

  • Make implicit nullable types explicit to avoid deprecation notice in PHP 8.4.

Full Changelog: https://github.com/amphp/socket/compare/v2.3.0...v2.3.1

v1.2.1

What's Changed

Full Changelog: https://github.com/amphp/socket/compare/v1.2.0...v1.2.1

v2.3.0
  • Added Socks5SocketConnector to connect to hosts via SOCKS5 proxies. A similar implementation was previously present in amphp/http-tunnel.
v2.2.4

What's Changed

  • Removed missed call to stream_context_set_option(), which was causing a deprecation notice on PHP 8.3.

Full Changelog: https://github.com/amphp/socket/compare/v2.2.3...v2.2.4

v2.2.3

What's Changed

  • Updated deprecated use of stream_context_set_option() on PHP 8.3.

Full Changelog: https://github.com/amphp/socket/compare/v2.2.2...v2.2.3

v2.2.2

What's Changed

  • Fixed bind errors being hidden when connecting in DnsSocketConnector ( #108).

Full Changelog: https://github.com/amphp/socket/compare/v2.2.1...v2.2.2

v2.2.1

What's Changed

  • Updated the default chunk size in ResourceUdpSocket to match the maximum UDP payload length.

Full Changelog: https://github.com/amphp/socket/compare/v2.2.0...v2.2.1

v2.2.0

What's Changed

New Contributors

Full Changelog: https://github.com/amphp/socket/compare/v2.1.0...v2.2.0

v2.1.0

What's Changed

Full Changelog: https://github.com/amphp/socket/compare/v2.0.0...v2.1.0

v2.0.0

Stable release compatible with AMPHP v3 and fibers! 🎉

As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.

See some of the changes in v2.0 of amphp/byte-stream since this library extends several of the interfaces in that library, particularly ReadableStream and WritableStream.

  • Moved methods from the EncryptableSocket interface to Socket and removed EncryptableSocket
  • Changed SocketAddress to an interface with two implementations: InternetAddress and UnixAddress
    • These implementations can be differentiated using SocketAddress::getType(), which returns an enum SocketAddressType with cases Unix and Internet
    • SocketAddress static constructors have been relocated as functions in the Amp\Socket\SocketAddress namespace.
  • Added connectTls function
  • Added bindUdpSocket function
  • Added ResourceUdpSocket and UdpSocket interface
  • Added ServerSocketFactory interface for creating ServerSocket instances along with an implementation ResourceServerSocketFactory
  • Renamed createPair function to createSocketPair
  • Renamed connector to socketConnector
  • Renamed Server to ResourceServerSocket and introduced ServerSocket interface
    • ResourceServerSocket::__construct() requires a BindContext instance
  • Renamed Connector to SocketConnector
  • Renamed DnsConnector to DnsSocketConnector
  • Renamed StaticConnector to StaticSocketConnector
  • Removed chunk size from BindContext, use chunk size parameters on listen / bindUdpSocket instead
  • Max attempts has been removed from ConnectContext in favor of a constructor parameter to RetrySocketConnector
  • DnsSocketConnector now tries each host returned from a DNS query a single time before failing. Retrying the list is accomplished through a new connector implementation, RetrySocketConnector that can be configured to retry a given number of times with an exponential backoff between attempts.
  • Default required TLS version is now 1.2+ instead of 1.0+

Changes from 2.0.0 Beta 9

  • Moved methods from the EncryptableSocket interface to Socket and removed EncryptableSocket
  • Renamed SocketServer to ServerSocket
  • Renamed SocketServerFactory to ServerSocketFactory
v2.0.0-beta.9
  • Fixed compatibility with v2.0 of amphp/dns
  • Fixed DnsException being thrown from DnsSocketConnector if DNS resolution failed. A ConnectException will be thrown instead with the DnsException as the previous exception
  • Fixed TLS state being incorrect in ResourceSocket if TLS setup fails
v2.0.0-beta.8
  • Fixed compatibility with v2.0 of amphp/byte-stream by updating ResourceSocket to implement Traversable.
v2.0.0-beta.7
v2.0.0-beta.6

Update for Closable interface being moved from amphp/byte-stream to amphp/amp.

  • SocketServer and DatagramSocket now extend Amp\Closable instead of Amp\ByteStream\Closable.
v2.0.0-beta.5
  • Fixed compatibility with systems not defining EAGAIN, e.g. Windows
v2.0.0-beta.4
  • Updated interfaces extending ClosableStream (which was renamed to Closable in amphp/byte-stream) to include the onClose method which was added to the interface.

  • SocketAddress has been changed to an interface with two implementations - InternetAddress and UnixAddress. These can be differentiated using SocketAddress::getType(), which returns an enum SocketAddressType with cases Unix and Internet.

  • SocketAddress static constructors have been relocated as functions in the Amp\Socket\SocketAddress namespace.

  • DnsSocketConnector now tries each host returned from a DNS query a single time before failing. Retrying the list is accomplished through a new connector implementation, RetrySocketConnector that can be configured to retry a given number of times with an exponential backoff between attempts.

  • Max attempts has been removed from ConnectContext in favor of a constructor parameter to RetrySocketConnector.

  • Added SocketServerFactory interface for creating SocketServer instances, along with an implementation ResourceSocketServerFactory.

  • EncryptableSocket::getTlsState() now returns an enum TlsState with cases corresponding to the prior constants defined in EncryptableSocket, which have been removed.

v2.0.0-beta.3
  • Require PHP 8.1+
  • Add ServerSocket::getBindContext()
  • Require BindContext in ResourceSocketServer::__construct()
  • Add ServerTlsContext::fromServerResource()
  • Improve DnsSocketConnector error messages to include IP addresses
  • Automatically determine DNS type if bindTo option is used for connections
v2.0.0-beta.2
  • Update to revolt/event-loop 0.2.x
v2.0.0-beta.1
  • Based on fibers instead of promises, so return types changed to avoid Promise
  • Default to TLSv1.2+ instead of TLSv1.0+
  • Added connectTls function
  • Added bindDatagram function
  • Added ResourceDatagramSocket and DatagramSocket interface
  • Renamed createPair function to createSocketPair
  • Renamed connector function to socketConnector
  • Renamed Server to ResourceSocketServer and introduced SocketServer interface
  • Renamed Connector to SocketConnector
  • Renamed DnsConnector to DnsSocketConnector
  • Renamed StaticConnector to StaticSocketConnector
  • Removed chunk size from BindContext, use parameters on listen / bindDatagram instead
v1.2.0
  • Add support for TLS 1.3 (#82)
v1.1.3
  • Removed error_get_last() calls in favor of custom error handlers to make the code independent of custom user error handlers.
v1.1.2
  • Fixed undefined array offset error (#76)
  • Fixed potential null type error
v1.1.1
  • Fixed ALPN whitespace resulting in TLS handshake errors with some rare servers (amphp/http-client#255)
  • Keep TlsInfo around in ResourceSocket (#71)
v1.1.0
  • Added Server::isClosed()
  • Added DatagramSocket::isClosed()
  • Added custom resolver support for DnsConnector (#70)
v0.10.13
  • Fixed an error where a socket pool would sometimes report that a socket did not belong to the pool if the socket was closed before being returned to the pool.
v1.0.0
  • Changed minimum PHP version to 7.1
  • Added support for UDP / datagrams
  • Added Connector interface
  • Added EncryptableSocket interface
  • Added SocketAddress in favor of raw strings
  • Added TlsInfo exposing a connection's TLS details
  • Added hasTlsAlpnSupport() / hasTlsSecurityLevelSupport()
  • Changed SocketPool::checkout() to accept an ConnectContext parameter
  • Renamed BasicSocketPool to UnlimitedSocketPool
  • Renamed pair() to createPair()
  • Renamed enableCrypto() to setupTls()
  • Renamed ClientConnectContext to ConnectContext
  • Renamed ServerListenContext to BindContext
  • Renamed CryptoException to TlsException
  • Removed cryptoConnect, use connect() and call $socket->setupTls() on the returned socket instead
  • Removed StaticSocketPool, use StaticConnector instead with any other SocketPool implementation
v0.10.12
  • Fixed URI parsing when the host is 0 (#60)
v0.10.11
  • connect() now immediately honors cancellation requests from cancellation tokens. Prior behavior waited for the connect timeout to elapse before checking for a cancellation request.
v0.10.10
  • Improved error message if ServerSocket::enableCrypto() is called without a TLS configuration being present.
v0.10.9
  • Added options to ClientConnectContext and ServerListenContext to enable or disable TCP_NODELAY.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport