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.
Full Changelog: https://github.com/amphp/socket/compare/v2.3.0...v2.3.1
Full Changelog: https://github.com/amphp/socket/compare/v1.2.0...v1.2.1
Socks5SocketConnector to connect to hosts via SOCKS5 proxies. A similar implementation was previously present in amphp/http-tunnel.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
stream_context_set_option() on PHP 8.3.Full Changelog: https://github.com/amphp/socket/compare/v2.2.2...v2.2.3
DnsSocketConnector ( #108).Full Changelog: https://github.com/amphp/socket/compare/v2.2.1...v2.2.2
ResourceUdpSocket to match the maximum UDP payload length.Full Changelog: https://github.com/amphp/socket/compare/v2.2.0...v2.2.1
league/uri 7.x$socket in example by @61-6c-69 in https://github.com/amphp/socket/pull/106Full Changelog: https://github.com/amphp/socket/compare/v2.1.0...v2.2.0
InternetAddress::tryFromString() by @trowski in https://github.com/amphp/socket/pull/105CidrMatcher by @kelunikFull Changelog: https://github.com/amphp/socket/compare/v2.0.0...v2.1.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.
EncryptableSocket interface to Socket and removed EncryptableSocketSocketAddress to an interface with two implementations: InternetAddress and UnixAddress
SocketAddress::getType(), which returns an enum SocketAddressType with cases Unix and InternetSocketAddress static constructors have been relocated as functions in the Amp\Socket\SocketAddress namespace.connectTls functionbindUdpSocket functionResourceUdpSocket and UdpSocket interfaceServerSocketFactory interface for creating ServerSocket instances along with an implementation ResourceServerSocketFactorycreatePair function to createSocketPairconnector to socketConnectorServer to ResourceServerSocket and introduced ServerSocket interface
ResourceServerSocket::__construct() requires a BindContext instanceConnector to SocketConnectorDnsConnector to DnsSocketConnectorStaticConnector to StaticSocketConnectorBindContext, use chunk size parameters on listen / bindUdpSocket insteadConnectContext in favor of a constructor parameter to RetrySocketConnectorDnsSocketConnector 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.EncryptableSocket interface to Socket and removed EncryptableSocketSocketServer to ServerSocketSocketServerFactory to ServerSocketFactoryv2.0 of amphp/dnsDnsException being thrown from DnsSocketConnector if DNS resolution failed. A ConnectException will be thrown instead with the DnsException as the previous exceptionResourceSocket if TLS setup failsv2.0 of amphp/byte-stream by updating ResourceSocket to implement Traversable.InternetAddress::fromString always failing (https://github.com/amphp/socket/pull/94)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.EAGAIN, e.g. WindowsUpdated 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.
ServerSocket::getBindContext()BindContext in ResourceSocketServer::__construct()ServerTlsContext::fromServerResource()DnsSocketConnector error messages to include IP addressesbindTo option is used for connectionsrevolt/event-loop 0.2.xPromiseconnectTls functionbindDatagram functionResourceDatagramSocket and DatagramSocket interfacecreatePair function to createSocketPairconnector function to socketConnectorServer to ResourceSocketServer and introduced SocketServer interfaceConnector to SocketConnectorDnsConnector to DnsSocketConnectorStaticConnector to StaticSocketConnectorBindContext, use parameters on listen / bindDatagram insteaderror_get_last() calls in favor of custom error handlers to make the code independent of custom user error handlers.TlsInfo around in ResourceSocket (#71)Server::isClosed()DatagramSocket::isClosed()DnsConnector (#70)Connector interfaceEncryptableSocket interfaceSocketAddress in favor of raw stringsTlsInfo exposing a connection's TLS detailshasTlsAlpnSupport() / hasTlsSecurityLevelSupport()SocketPool::checkout() to accept an ConnectContext parameterBasicSocketPool to UnlimitedSocketPoolpair() to createPair()enableCrypto() to setupTls()ClientConnectContext to ConnectContextServerListenContext to BindContextCryptoException to TlsExceptioncryptoConnect, use connect() and call $socket->setupTls() on the returned socket insteadStaticSocketPool, use StaticConnector instead with any other SocketPool implementation0 (#60)connect() now immediately honors cancellation requests from cancellation tokens. Prior behavior waited for the connect timeout to elapse before checking for a cancellation request.ServerSocket::enableCrypto() is called without a TLS configuration being present.ClientConnectContext and ServerListenContext to enable or disable TCP_NODELAY.How can I help you explore Laravel packages today?