Network tools Library for PHP with native Yggdrasil / IPv6 support
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yggverse 3329a90819 fix data types, add fragment support, draft absolute method 9 months ago
src fix data types, add fragment support, draft absolute method 9 months ago
.gitignore initial commit 1 year ago
LICENSE Initial commit 1 year ago
README.md fix data types, add fragment support, draft absolute method 9 months ago
composer.json update project name 1 year ago

README.md

net-php

Network Library for PHP with native Yggdrasil support

Install

composer require yggverse/net

Usage

Socket

Check socket is open

var_dump(
    \Yggverse\Net\Socket::isOpen('yo.index', 80)
);

Check host valid

var_dump(
    \Yggverse\Net\Socket::isHost('yo.index')
);

Check port valid

var_dump(
    \Yggverse\Net\Socket::isPort(80)
);

Dig

Resolve records

var_dump(
    \Yggverse\Net\Dig::records('yo.index', ['A', 'AAAA'])
);

Check hostname valid

var_dump(
    \Yggverse\Net\Dig::isHostName('yo.index')
);

Check record valid

var_dump(
    \Yggverse\Net\Dig::isRecord('A')
);

Check record value valid

var_dump(
    \Yggverse\Net\Dig::isRecordValue('A', '127.0.0.1')
);

Address

Includes useful methods to work with network addresses

$address = new \Yggverse\Net\Address(
    'http://yo.ygg'
);

var_dump(
    $address->getScheme() // Scheme substring
);

...

$subject = new \Yggverse\Net\Address(
    './some/uri'
);

var_dump(
    $address->absolute(
        $subject
    ) // return http://yo.ygg/some/uri
);

Integrations