grantlucas/php-portfinder

A simple tool to find an available port within a range.

v1.0 2015-01-12 16:29 UTC

This package is auto-updated.

Last update: 2024-08-22 07:52:27 UTC


README

A simple PHP package to find an available port within a range.

Installation using Composer

$ composer require grantlucas/php-portfinder

Usage

The following will return the first available port within the range for the provided host.

require_once(__DIR__ . '/vendor/autoload.php');
use GrantLucas\PortFinder;

$port = PortFinder::range('127.0.0.1', 9901, 9999);