Check ports with protocol. This package uses under the hood ReactPHP Promises.
You can install the package via composer:
composer require gemz/port
use \Gemz\Port\Port;
$checks = new Port('gemz.io');
// or
$checks = Port::for('gemz.io');
// check all default ports on tcp
$checks = Port::for('gemz.io')->check();
// check specific ports on tcp
$checks = Port::for('gemz.io')->check(80, 8080, 443, 22, 3306, 9000, 9001);
// check only specific ports on tcp
$checks = Port::for('gemz.io')->useTcp()->check(80, 8080);
// check only specific ports on udp
$checks = Port::for('gemz.io')->useUdp()->check(110, 140);
// check only specific ports on tls
$checks = Port::for('gemz.io')->useTls()->check(443);
// check only specific ports on ssl
$checks = Port::for('gemz.io')->useSsl()->check(443);
// check with array for specific port => protocol checks
// if global setting will be ignored
$checks = Port::for('gemz.io')->useTcp()->check([80 => 'tcp', 2525 => 'udp', 443 => 'tls']);
// check with array for specific port
$checks = Port::for('gemz.io')->useTcp()->check([80, 2525, 443]);
// set timeout, default is 0.5s
$checks = Port::for('gemz.io')->setTimeout(0.4)->check(80);
// get supported protocols
$protocols = Port::for('gemz.io')->getProtocols();
// get default ports
$ports = Port::for('gemz.io')->getDefaultPorts();
// get domain
$protocols = Port::for('gemz.io')->getDomain();
composer test
composer test-coverage
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Gemz.io is maintained by Stefan Riehl. You'll find all open source projects on Gemz.io github.
The MIT License (MIT). Please see License File for more information.