zero-to-prod/stream-socket

A wrapper for stream_socket_client()

v71.0.6 2025-01-13 00:34 UTC

This package is auto-updated.

Last update: 2025-01-23 14:16:27 UTC


README

Repo GitHub Actions Workflow Status Packagist Downloads Packagist Version GitHub repo size License Hits-of-Code

Contents

Introduction

A wrapper for the stream_socket_client() method.

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

Requirements

  • PHP 7.1 or higher.

Installation

Install Zerotoprod\StreamSocket via Composer:

composer require zero-to-prod/stream-socket

This will add the package to your project’s dependencies and create an autoloader entry for it.

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

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page if you want to contribute.

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit changes (git commit -m 'Add some feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a new Pull Request.