PHPackages                             palepurple/nmap - 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. palepurple/nmap

ActiveLibrary

palepurple/nmap
===============

nmap is a PHP wrapper for Nmap, a free security scanner for network exploration. This is (mostly) a fork of willdurand/nmap with PHP 7 and vimeo/psalm static analysis improvements.

4.0.3(6mo ago)133.4k↓38.2%3MITPHPPHP &gt;= 8.1CI passing

Since Nov 5Pushed 3mo ago2 watchersCompare

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

READMEChangelog (7)Dependencies (7)Versions (23)Used By (0)

**This project is maintained fork of the original project: **

Nmap
====

[](#nmap)

**Nmap** is a PHP wrapper for [Nmap](http://nmap.org/), a free security scanner for network exploration.

[![PHP Build](https://github.com/DavidGoodwin/nmap/workflows/PHP%20Build/badge.svg)](https://github.com/DavidGoodwin/nmap/workflows/PHP%20Build/badge.svg)

Starting a scan
---------------

[](#starting-a-scan)

```
$hosts = Nmap::create()->scan([ 'example.com' ]);

$ports = $hosts[0]->getOpenPorts();
```

You can specify the ports you want to scan:

```
$nmap = new Nmap();

$nmap->scan([ 'example.com' ], [ 21, 22, 80 ]);
```

**OS detection** and **Service Info** are disabled by default, if you want to enable them, use the `enableOsDetection()` and/or `enableServiceInfo()` methods:

```
$nmap
    ->enableOsDetection()
    ->scan([ 'example.com' ]);

$nmap
    ->enableServiceInfo()
    ->scan([ 'example.com' ]);

// Fluent interface!
$nmap
    ->enableOsDetection()
    ->enableServiceInfo()
    ->scan([ 'example.com' ]);
```

Turn the **verbose mode** by using the `enableVerbose()` method:

```
$nmap
    ->enableVerbose()
    ->scan([ 'example.com' ]);
```

For some reasons, you might want to disable port scan, that is why **nmap**provides a `disablePortScan()` method:

```
$nmap
    ->disablePortScan()
    ->scan([ 'example.com' ]);
```

You can also disable the reverse DNS resolution with `disableReverseDNS()`:

```
$nmap
    ->disableReverseDNS()
    ->scan([ 'example.com' ]);
```

You can define the process timeout (default to 60 seconds) with `setTimeout()`:

```
$nmap
    ->setTimeout(120)
    ->scan([ 'example.com' ]);
```

You can run specific scripts with `setScripts()` and get the result with `getScripts()`:

```
$hosts = $nmap
    ->setTimeout(120)
    ->scan([ 'example.com' ], [ 443 ]);

$hosts[0]->setScripts(['ssl-heartbleed']);
$ports = $hosts[0]->getOpenPorts();

$ports[0]->getScripts();
```

Nmap XML output
---------------

[](#nmap-xml-output)

Parse existing output:

```
Nmap::parseOutput($xmlFile);
```

or

```
$parser = new XmlOutputParser($xmlFile);
$parser->parse();
```

Validation output file using the Nmap DTD. A custom DTD path can be passed to the validate function.

```
$parser = new XmlOutputParser($xmlFile);
$parser->validate();
```

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

[](#installation)

The recommended way to install nmap is through [Composer](http://getcomposer.org/):

For PHP 8.0 and above -

```
{
    "require": {
        "palepurple/nmap": "^3.0"
    }
}
```

For older versions of PHP, try ^2.0; see also

License
-------

[](#license)

nmap is released under the MIT License. See the bundled LICENSE file for details.

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance75

Regular maintenance activity

Popularity30

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Every ~219 days

Recently: every ~179 days

Total

21

Last Release

180d ago

Major Versions

0.5.0 → 1.02019-04-03

1.2 → 2.02020-02-26

v2.x-dev → 3.0.02022-09-01

3.0.2 → v4.0.02025-02-27

PHP version history (5 changes)v0.0.1PHP &gt;=5.3.0

1.0PHP &gt;=5.6.0

2.0PHP &gt;= 7.2

3.0.0PHP &gt;= 8.0

v4.0.0PHP &gt;= 8.1

### Community

Maintainers

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

---

Top Contributors

[![DavidGoodwin](https://avatars.githubusercontent.com/u/203929?v=4)](https://github.com/DavidGoodwin "DavidGoodwin (54 commits)")[![wvdongen](https://avatars.githubusercontent.com/u/1862615?v=4)](https://github.com/wvdongen "wvdongen (38 commits)")[![willdurand](https://avatars.githubusercontent.com/u/217628?v=4)](https://github.com/willdurand "willdurand (29 commits)")[![peter17](https://avatars.githubusercontent.com/u/752832?v=4)](https://github.com/peter17 "peter17 (10 commits)")[![Falc](https://avatars.githubusercontent.com/u/246051?v=4)](https://github.com/Falc "Falc (6 commits)")[![matejvelikonja](https://avatars.githubusercontent.com/u/1881087?v=4)](https://github.com/matejvelikonja "matejvelikonja (2 commits)")[![maidmaid](https://avatars.githubusercontent.com/u/4578773?v=4)](https://github.com/maidmaid "maidmaid (1 commits)")[![arall](https://avatars.githubusercontent.com/u/1453137?v=4)](https://github.com/arall "arall (1 commits)")[![mtdavidson](https://avatars.githubusercontent.com/u/201792?v=4)](https://github.com/mtdavidson "mtdavidson (1 commits)")[![Gemorroj](https://avatars.githubusercontent.com/u/885731?v=4)](https://github.com/Gemorroj "Gemorroj (1 commits)")[![Rikstone](https://avatars.githubusercontent.com/u/46562501?v=4)](https://github.com/Rikstone "Rikstone (1 commits)")[![W0rma](https://avatars.githubusercontent.com/u/20659830?v=4)](https://github.com/W0rma "W0rma (1 commits)")[![EmmanuelVella](https://avatars.githubusercontent.com/u/663607?v=4)](https://github.com/EmmanuelVella "EmmanuelVella (1 commits)")[![clarkstuth](https://avatars.githubusercontent.com/u/1616268?v=4)](https://github.com/clarkstuth "clarkstuth (1 commits)")

---

Tags

nmapphp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/palepurple-nmap/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)

PHPackages © 2026

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