Download the PHP package paragi/php-websocket-client without Composer

On this page you can find all versions of the php package paragi/php-websocket-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?
paragi/php-websocket-client
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package php-websocket-client

Websocket client for PHP

Use PHP to connect to at websocket service. These 3 methods make the websocket negotiation and connection and handle the hybi10 frame encoding required.

Note : unlike the library ratchetphp/Pawl, this a synchronous library that could be used within blocking kernels like Symfony for example.

Example 1:

Example 2, using a session cookie and setting timeout:

Example 3, using SSL

Client class

Constructor

Open websocket connection

__construct(string $host [, int $port [, array $additional_headers [, string &error_string [, int $timeout [, resource $context]]]]] )

host A host URL. It can be a domain name like www.example.com or an IP address like local host: 127.0.0.1

port The servers port number

headers (optional) additional HTTP headers to attach to the request. For example to parse a session cookie.

error_string (optional) A referenced variable to store error messages, if any.

timeout (optional) The maximum time in seconds, a read operation will wait for an answer from the server. Default value is 10 seconds.

context (optional) A stream context resource created with stream_context_create() used to set various socket stream options.

write

Send data to server through the websocket, using hybi10 frame encoding.

int write(string $data [,boolean $final])

data Data to transport to server

final (optional) indicate if this block is the final data block of this request. Default true

read

Read data through websocket from the server, using hybi10 frame encoding.

string read([string &error_string])

error_string (optional) A referenced variable to store error messages, i any.

Note:

Exception

If anything goes wrong (connection, write, read...), a ConnectionException is thrown back. Please catch them all to return a comprehensive message (here's is a sample in a Symfony context) :

Tests

Tests are running against a local echo server implemented with Ratchet. You'll have to manually start the server in ANOTHER process.

And now you can launch PhpUnit

Code coverage

With PhpDbg, just launch :

Contribute

Please let me know if there is any problems with the code. Any contributions are accepted, if the code looks nice, not bloated and otherwise reasonable.

License: MIT: Free

TODO


All versions of php-websocket-client with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package paragi/php-websocket-client contains the following files

Loading the files please wait ....