| Package Data | |
|---|---|
| Maintainer Username: | parsidev |
| Maintainer Contact: | info@parsidev.ir (Mohammad Reza) |
| Package Create Date: | 2017-07-16 |
| Package Last Update: | 2022-08-01 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-03 03:02:24 |
| Package Statistics | |
|---|---|
| Total Downloads: | 1,568 |
| Monthly Downloads: | 3 |
| Daily Downloads: | 0 |
| Total Stars: | 22 |
| Total Watchers: | 1 |
| Total Forks: | 11 |
| Total Open Issues: | 3 |
For install this package Edit your project's composer.json file to require parsidev/tcp-socket
"require": {
"parsidev/tcp-socket": "dev-master"
},
Now, update Composer:
composer update
Once composer is finished, you need to add the service provider. Open config/app.php, and add a new item to the providers array.
'Parsidev\Socket\SocketServiceProvider',
Next, add a Facade for more convenient usage. In config/app.php add the following line to the aliases array:
'Socket' => 'Parsidev\Socket\Facades\Socket',
Publish config files:
php artisan vendor:publish --provider="Parsidev\Socket\SocketServiceProvider"
for change username, password and other configuration change config/tcpsocket.php
Open config/tcp-socket.php
Enter Server Ip Address and Port
You can change server protocol between SOL_TCP and SOL_UDP
$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