zero-to-prod/stream-socket

A wrapper for stream_socket_client()

v71.0.0 2024-09-08 13:16 UTC

This package is auto-updated.

Last update: 2024-09-08 13:24:06 UTC


README

Repo Latest Version on Packagist test Downloads

A wrapper for the stream_socket_client() method.

It provides classes that define all the options for this method.

Installation

To install this package, add it to your composer.json file and run composer install:

composer require zerotoprod/stream-socket

Usage

use Zerotoprod\StreamSocket\StreamSocket;

StreamSocket::client(
    'ssl://'.$url.':'. 443,
    30
    STREAM_CLIENT_CONNECT,
    stream_context_create()
);

echo $SocketClient->remoteSocketName(); // 34.223.124.45:443

$SocketClient->close();