zero-to-prod/stream-socket

A wrapper for stream_socket_client()

v71.0.2 2024-10-18 13:58 UTC

This package is auto-updated.

Last update: 2024-10-25 09:02:32 UTC


README

Repo GitHub Actions Workflow Status Packagist Downloads Packagist Version GitHub repo size License

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();