A simple socket client for PHP 5.2+, bundled with a collection of useful client libraries.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
README
simplesocketclient.php

README

A Simple Socket Client for PHP 5.2+
===================================

This library contains one class, SimpleSocketClient, that implements a generic
socket client. You can either inherit this class or use instances of this class
to write client libraries for any modern text-based protocol.

Fully featured client libraries, included as examples:

  * Clamd
  * HTTP
  * Memcached
  * Redis

Features:

  * Socket creation, reading, and writing (of course).
  * Lazy loading : will not connect until actually needed.
  * Automatically deal with end-of-line CRLF sequences.
  * Basic key validation and command building helper methods.

Public methods:

  * __construct($host, $port, $timeout = 5)
  * connect()
  * disconnect()
  * read($bytes, $autonewline = true, $trim = true)
  * readline($trim = true)
  * write($string, $autonewline = true)
  * validate_key($key)
  * build_command()

License: MIT License.