PHP code example of parsidev / tcp-socket

1. Go to this page and download the library: Download parsidev/tcp-socket library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

parsidev / tcp-socket example snippets


"    "parsidev/tcp-socket": "dev-master"
},

$socket = Socket::connect();

$socket = Socket::connect($ip);
$socket = Socket::connect(null, $port);
$socket = Socket::connect($ip, $port);

Socket::disconnect($socket);

Socket::sendMessage('test message'); //send message to connected server
Socket::sendMessageTo('test message', 'server ip', server port) // send message to a socket
config/app.php
config/app.php

'Socket' => 'Parsidev\Socket\Facades\Socket',

php artisan vendor:publish --provider="Parsidev\Socket\SocketServiceProvider"
config/tcpsocket.php
config/tcp-socket.php