NetDNS2 v2.x changed to a PSR-4 style layout using namespaces, so moving from v1.x to v2.x requires updating your code to match to the new semantics.
For example:
v1.x
try
{
$r = new Net_DNS2_Resolver([ 'nameservers' => [ '192.168.0.1' ]]);
$res = $r->query('google.com', 'MX');
} catch(Net_DNS2_Exception $e)
{
print_r($e);
}
v2.x
try
{
$r = new \NetDNS2\Resolver([ 'nameservers' => [ '192.168.0.1' ]]);
$res = $r->query('google.com', 'MX');
} catch(\NetDNS2\Exception $e)
{
print_r($e);
}
While all the underlying objects have been reorganized into namespaces, the majority of the class, function, and property names have remained the same, so upgrading should not require too many changes.
To continue using NetDNS2 v1.x, update your composer.json
file to specify 1.x, e.g.:
{
"require": {
"pear/net_dns2": "^1.5"
}
}
Version 1.x will be maintained for the foreseeable future.
Version 2.0.0
IMPORTANT: this release is not backwards compatible with v1.x – see the README for more details on upgrading.
- Minimum PHP version was increased to 8.1; this version uses strong typing, ENUMs, and other modern PHP features.
- Complete code re-factor, converting to PSR-4 style autoloading, and namespace semantics.
- Added support for DNS over TLS (DoT).
- Added support for DNS over HTTPS (DoH).
- Added support for (almost) all EDNS(0) features (client subnet, cookies, TCP keepalives, etc.)
- Added Memcache & Redis support in the local cache object.
- Added the HTTPS, SVCB, DSYNC, and other resource records.