PHPackages                             c3c/portscan-async - 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. c3c/portscan-async

ActiveLibrary

c3c/portscan-async
==================

An asynchronous port scanner in PHP

3264PHP

Since Oct 8Pushed 12y ago2 watchersCompare

[ Source](https://github.com/c3c/portscan-async)[ Packagist](https://packagist.org/packages/c3c/portscan-async)[ RSS](/packages/c3c-portscan-async/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Asynchronous port scanner in PHP
================================

[](#asynchronous-port-scanner-in-php)

This package offers a portscan utility to determine if a host is reachable on a certain (TCP) port or not.

#### Scenario

[](#scenario)

A status page has to report if certain hosts are online. Using the normal methods, each host will be checked sequentially, which is slow. Thanks to this class, all of the checks are performed asynchronously, and the status of all hosts can be checked in a non-blocking way.

Functions
---------

[](#functions)

- `setTimeout($float)` : timeout for all checks to terminate
- `addTest($host, $port)` : add a host to test
- `scan()` : start scan
- `results` : variable that holds the results

Example
-------

[](#example)

```
$ss = new PortScan\Scanner;
$ss->setTimeout(2);

$ss->addTest('yahoo.com', 80);
$ss->addTest('google.com', 80);
$ss->addTest('1.2.3.4', 80);

$ss->scan();
var_dump($ss->results);
```

##### Result

[](#result)

```
array(3) {
  ["google.com"]=>
  array(1) {
    [80]=>     ## Holds the port
    int(0)     ## Holds the error number (0 = port open)
  }
  ["yahoo.com"]=>
  array(1) {
    [80]=>
    int(0)
  }
  ["1.2.3.4"]=>
  array(1) {
    [80]=>
    int(10060)
  }
}

```

For an overview of error numbers, look [here](http://www.php.net/manual/en/sockets.constants.php#108291).

---

###### Future

[](#future)

- callbacks per test/globally
- UDP scan (although I'm not sure how to do this reliably)

###### Keywords

[](#keywords)

multi threaded port scan status check checker scanner open closed non-blocking

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/37b971eeb94c5bc60a6fb492f7538daf21aa05c83e65c9bcb7db94a174df9d51?d=identicon)[c3c](/maintainers/c3c)

---

Top Contributors

[![c3c](https://avatars.githubusercontent.com/u/2326945?v=4)](https://github.com/c3c "c3c (8 commits)")

### Embed Badge

![Health badge](/badges/c3c-portscan-async/health.svg)

```
[![Health](https://phpackages.com/badges/c3c-portscan-async/health.svg)](https://phpackages.com/packages/c3c-portscan-async)
```

PHPackages © 2026

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