gemz / port
Domain Port Check
Fund package maintenance!
Patreon
Requires
- php: ^7.1.3
- react/promise: ^2.7
Requires (Dev)
- mockery/mockery: ^1.0
- phpstan/phpstan: ^0.12.8
- phpunit/phpunit: ^8.2
- symfony/var-dumper: ^4.3
README
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.