Download the PHP package amphp/dns without Composer

On this page you can find all versions of the php package amphp/dns. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dns

amphp/dns

AMPHP is a collection of event-driven libraries for PHP designed with fibers and concurrency in mind. amphp/dns provides hostname to IP address resolution and querying specific DNS records.

Latest Release MIT License

Installation

This package can be installed as a Composer dependency.

Usage

Configuration

amphp/dns automatically detects the system configuration and uses it. On Unix-like systems it reads /etc/resolv.conf and respects settings for nameservers, timeouts, and attempts. On Windows it looks up the correct entries in the Windows Registry and takes the listed nameservers. You can pass a custom ConfigLoader instance to Rfc1035StubResolver to load another configuration, such as a static config.

It respects the system's hosts file on Unix and Windows based systems, so it works just fine in environments like Docker with named containers.

The package uses a global default resolver which can be accessed and changed via Amp\Dns\resolver(). If an argument other than null is given, the resolver is used as global instance.

Usually you don't have to change the resolver. If you want to use a custom configuration for a certain request, you can create a new resolver instance and use that instead of changing the global one.

Hostname to IP Resolution

Amp\Dns\resolve provides hostname to IP address resolution. It returns an array of IPv4 and IPv6 addresses by default. The type of IP addresses returned can be restricted by passing a second argument with the respective type.

Custom Queries

Amp\Dns\query supports the various other DNS record types such as MX, PTR, or TXT. It automatically rewrites passed IP addresses for PTR lookups.

Caching

The Rfc1035StubResolver caches responses by default in an Amp\Cache\LocalCache. You can set any other Amp\Cache\Cache implementation by creating a custom instance of Rfc1035StubResolver and setting that via Amp\Dns\resolver(), but it's usually unnecessary. If you have a lot of very short running scripts, you might want to consider using a local DNS resolver with a cache instead of setting a custom cache implementation, such as dnsmasq.

Reloading Configuration

The Rfc1035StubResolver (which is the default resolver shipping with that package) will cache the configuration of /etc/resolv.conf / the Windows Registry and the read host files by default. If you wish to reload them, you can set a periodic timer that requests a background reload of the configuration.

Note The above code relies on the resolver not being changed. reloadConfig is specific to Rfc1035StubResolver and is not part of the Resolver interface.

Example


All versions of dns with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-filter Version *
amphp/amp Version ^3
amphp/byte-stream Version ^2
amphp/cache Version ^2
amphp/parser Version ^1
amphp/windows-registry Version ^1.0.1
daverandom/libdns Version ^2.0.2
revolt/event-loop Version ^1 || ^0.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package amphp/dns contains the following files

Loading the files please wait ....