PHPackages                             claudiograssia/zf2socket - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. claudiograssia/zf2socket

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

claudiograssia/zf2socket
========================

Socket server for zend 2

0.0.1.x-dev(10y ago)00GPL 3PHP

Since Jun 18Pushed 9y ago1 watchersCompare

[ Source](https://github.com/claudiograssia/Zf2Socket)[ Packagist](https://packagist.org/packages/claudiograssia/zf2socket)[ RSS](/packages/claudiograssia-zf2socket/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Zf2Socket
=========

[](#zf2socket)

Installation
------------

[](#installation)

with [Composer](http://getcompoer.org) and install dependecies hoa\\socket.

```
{
    "require": {
        "claudiograssia/zf2socket": "0.0.1-dev"
    }
}
```

The first step after installation, write into **config/application.config.php**

```
return array(
    'modules' => array(
        "Zf2Socket",
        "Application",
        "etc"
    )
)
```

start test socket into terminal with this command

`myprojectzf2/public php index.php socket test`
-----------------------------------------------

[](#myprojectzf2public-php-indexphp-socket-test)

or use

Example Use
-----------

[](#example-use)

will be use with zendframework 2.

And it is be start with console router. Create a console become this example

```
module.config.php

```

```
return array(
    'console' => array(
        'router' => array(
            'routes' => array(
                'indexer' => array(
                    'options' => array(
                        'route' => 'socket',
                        'defaults' => array(
                            'controller' => 'Application\Controller\Index',
                            'action' => 'index'
                        )
                    )
                )
            ),
        ),
    )
)
```

```
class IndexController extends AbstractActionController {

    public function indexAction() {

        $server = $this->getServerService();
        $server->init('tcp://127.0.0.1:4242', function($server) {
            $line = $server->readLine();

            if (empty($line)) {
                $server->disconnect();
                continue;
            }

            echo '< ', $line, "\n";
            $server->writeLine(strtoupper($line));
        });

    }

    /**
     * @return \Zf2Socket\Service\Server
     */
    protected function getServerService() {
        return $this->getServiceLocator()->get('SocketServer');
    }
}
```

Start socket with command into terminal

`myprojectzf2/public php index.php socket`
------------------------------------------

[](#myprojectzf2public-php-indexphp-socket)

and it will can be use with terminal

```
$ telnet 127.0.0.1
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
test
test
```

or it will can be use with python

```
import socket
import sys

# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Connect the socket to the port where the server is listening
server_address = ('127.0.0.1', 4242)
print >>sys.stderr, 'connecting to %s port %s' % server_address
sock.connect(server_address)
```

License
-------

[](#license)

This library is a free project and it can be use for any project.

Attention read also license dependencies this library.

### THANX FOR HAVE READ THIS DOCUMENT

[](#thanx-for-have-read-this-document)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3987d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/52e314e862dde20b2af90b1e72738f9d1664f53f316ef8385ad99c5ca5b41396?d=identicon)[claudiograssia](/maintainers/claudiograssia)

---

Top Contributors

[![claudiograssia](https://avatars.githubusercontent.com/u/8168945?v=4)](https://github.com/claudiograssia "claudiograssia (41 commits)")

---

Tags

libraryserverzendSocketzf2

### Embed Badge

![Health badge](/badges/claudiograssia-zf2socket/health.svg)

```
[![Health](https://phpackages.com/badges/claudiograssia-zf2socket/health.svg)](https://phpackages.com/packages/claudiograssia-zf2socket)
```

###  Alternatives

[clue/socket-raw

Simple and lightweight OOP wrapper for PHP's low-level sockets extension (ext-sockets).

35111.1M48](/packages/clue-socket-raw)

PHPackages © 2026

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