PHPackages                             isathais1/tcp-socket - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. isathais1/tcp-socket

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

isathais1/tcp-socket
====================

TCP Socket for Laravel 5

016PHP

Since Apr 13Pushed 8y ago1 watchersCompare

[ Source](https://github.com/isathais1/TCP-Socket)[ Packagist](https://packagist.org/packages/isathais1/tcp-socket)[ RSS](/packages/isathais1-tcp-socket/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel 5 TCP Socket
====================

[](#laravel-5-tcp-socket)

installation
------------

[](#installation)

For install this package Edit your project's `composer.json` file to require isathais1/tcp-socket

```
"require": {
    "isathais1/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.

```
'isathais1\Socket\SocketServiceProvider',

```

Next, add a Facade for more convenient usage. In `config/app.php` add the following line to the aliases array:

```
'Socket' => 'isathais1\Socket\Facades\Socket',

```

Publish config files:

```
php artisan vendor:publish --provider="isathais1\Socket\SocketServiceProvider"

```

for change username, password and other configuration change `config/tcp-socket.php`

Usage
-----

[](#usage)

\###Configuration Open `config/tcp-socket.php`

Enter Server Ip Address and Port
You can change server protocol between `SOL_TCP` and `SOL_UDP`

### Connect To Server

[](#connect-to-server)

```
Socket::connect();

Socket::connect($ip);
Socket::connect(null, $port);
Socket::connect($ip, $port);
```

### Disconnect from Server

[](#disconnect-from-server)

```
Socket::disconnect();
```

### Send Message

[](#send-message)

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

### Read Message

[](#read-message)

```
$response = Socket::readMessage(); //Read message with 2048 byte buffer

Or

$response = Socket::readMessage($length)//Read message with custom byte buffer;

$response = Socket::readMessage($length,$type)//Read message with custom byte buffer and custom type(PHP_NORMAL_READ or PHP_BINARY_READ);
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e4ef3b640303d92664d42cb4ab095b5310fb4d36bd3edb7c5c2966ad83bfc673?d=identicon)[isathais1](/maintainers/isathais1)

---

Top Contributors

[![parsidev](https://avatars.githubusercontent.com/u/11275201?v=4)](https://github.com/parsidev "parsidev (30 commits)")[![isa-alexandre](https://avatars.githubusercontent.com/u/65176227?v=4)](https://github.com/isa-alexandre "isa-alexandre (4 commits)")

### Embed Badge

![Health badge](/badges/isathais1-tcp-socket/health.svg)

```
[![Health](https://phpackages.com/badges/isathais1-tcp-socket/health.svg)](https://phpackages.com/packages/isathais1-tcp-socket)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
