PHPackages                             dooaki/net-empty\_port - 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. dooaki/net-empty\_port

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

dooaki/net-empty\_port
======================

find a free TCP/UDP port

0.0.2(12y ago)161MITPHPPHP &gt;=5.3.0

Since Oct 2Pushed 12y ago1 watchersCompare

[ Source](https://github.com/do-aki/Net-EmptyPort)[ Packagist](https://packagist.org/packages/dooaki/net-empty_port)[ Docs](https://github.com/do-aki/Net-EmptyPort)[ RSS](/packages/dooaki-net-empty-port/feed)WikiDiscussions master Synced today

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

Net-EmptyPort
=============

[](#net-emptyport)

[![Build Status](https://camo.githubusercontent.com/669503872e98f15cbc07d40c528d566f84d8c3b372fec0c9393e1df2e910deac/68747470733a2f2f7472617669732d63692e6f72672f646f2d616b692f4e65742d456d707479506f72742e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/do-aki/Net-EmptyPort)[![Coverage Status](https://camo.githubusercontent.com/47392200c94c5afa48e3efaed77350c245d9bf1d4984d26ccecae0475006c2d6/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f646f2d616b692f4e65742d456d707479506f72742f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/do-aki/Net-EmptyPort?branch=master)

Net-EmptyPort is php library finding an empty TCP/UDP port.

Original is cpan module [Net::EmptyPort](https://metacpan.org/module/Net::EmptyPort)

Requirements
------------

[](#requirements)

- PHP 5.3 or later
- Sockets Support enabled (--enable-sockets)

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

[](#installation)

you can install the script with [Composer](http://getcomposer.org/).

in your `composer.json` file:

```
{
    "require": {
        "dooaki/net-empty_port": "dev-master"
    }
}

```

```
composer.phar install

```

Methods
-------

[](#methods)

### find(\[$port, $proto\])

[](#findport-proto)

find free TCP port

```
  use dooaki\Net\EmptyPort;

  $port = EmptyPort::find(5963); // 5963..65535

```

find free UDP port

```
  $port = EmptyPort::find(null, 'udp'); // 1024..65535

```

### isPortUsed($port, \[$proto\])

[](#isportusedport-proto)

checks the given port is already used. also works for UDP

```
  $dns_udp_used = EmptyPort::isPortUsed(53, 'udp');

```

### wait($port, $max\_wait\_sec\[, $protol\])

[](#waitport-max_wait_sec-protol)

wait for a particular port is available for connect.

Author
------

[](#author)

do\_aki &lt;do.hiroaki at gmail.com&gt;

License
-------

[](#license)

MIT License

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

4654d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/302784?v=4)[do\_aki](/maintainers/do-aki)[@do-aki](https://github.com/do-aki)

---

Top Contributors

[![do-aki](https://avatars.githubusercontent.com/u/302784?v=4)](https://github.com/do-aki "do-aki (6 commits)")

---

Tags

tcpSocketnetudp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dooaki-net-empty-port/health.svg)

```
[![Health](https://phpackages.com/badges/dooaki-net-empty-port/health.svg)](https://phpackages.com/packages/dooaki-net-empty-port)
```

###  Alternatives

[clue/socket-raw

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

35211.7M50](/packages/clue-socket-raw)[corley/influxdb-sdk

Send your app metrics to InfluxDB

84297.7k2](/packages/corley-influxdb-sdk)[binsoul/net-mqtt

MQTT protocol implementation

28905.3k7](/packages/binsoul-net-mqtt)[trafficcophp/bytebuffer

Node.js inspired byte stream buffer for PHP.

33463.7k18](/packages/trafficcophp-bytebuffer)[zoon/rialto

Manage Node resources from PHP

12233.1k3](/packages/zoon-rialto)[marcelog/ding

PHP Dependency Injection based on Spring(tm), with Aspect Oriented Programming, MVC

1192.1k](/packages/marcelog-ding)

PHPackages © 2026

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