Skip to content

EGYWEB-Mohamed/port

 
 

Repository files navigation

Domain Port Check

Latest Version on Packagist GitHub Tests Action Status Quality Score Total Downloads

Check ports with protocol. This package uses under the hood ReactPHP Promises.

Installation

You can install the package via composer:

composer require gemz/port

Usage

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();

Testing

composer test
composer test-coverage

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email stefan@sriehl.com instead of using the issue tracker.

Credits

Support us

Gemz.io is maintained by Stefan Riehl. You'll find all open source projects on Gemz.io github.

License

The MIT License (MIT). Please see License File for more information.

About

Check ports with protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%