Download the PHP package remotelyliving/php-dns without Composer

On this page you can find all versions of the php package remotelyliving/php-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 php-dns

Build Status Total Downloads Coverage Status License Scrutinizer Code Quality PHP CI

PHP-DNS: A DNS Abstraction in PHP

Use Cases

This library might be for you if:

Installation

Usage

Basic Resolvers can be found in src/Resolvers

These resolvers at the least implement the Resolvers\Interfaces\DNSQuery interface

Chain Resolver

The Chain Resolver can be used to read through DNS Resolvers until an answer is found. Whichever you pass in first is the first Resolver it tries in the call sequence. It implements the same DNSQuery interface as the other resolvers but with an additional feature set found in the Chain interface.

So something like:

That will call the GoogleDNS Resolver first, if no answer is found it will continue on to the LocalSystem Resolver. The default call through strategy is First to Find aka Resolvers\Interfaces\Chain::withFirstResults(): Chain

You can randomly select which Resolver in the chain it tries first too via Resolvers\Interfaces\Chain::randomly(): Chain Example:

The above code calls through the resolvers randomly until it finds any non empty answer or has exhausted order the chain.

Lastly, and most expensively, there is Resolvers\Interfaces\Chain::withAllResults(): Chain and Resolvers\Interfaces\Chain::withConsensusResults(): Chain All results will be a merge from all the different sources, useful if you want to see what all is out there. Consensus results will be only the results in common from source to source.

src/Resolvers/Interfaces

Cached Resolver

If you use a PSR6 cache implementation, feel free to wrap whatever Resolver you want to use in the Cached Resolver. It will take in the the lowest TTL of the record(s) and use that as the cache TTL. You may override that behavior by setting a cache TTL in the constructor.

If you do not wish to cache empty result answers, you may call through with this additional option:

Entities

Take a look in the src/Entities to see what's available for you to query by and receive.

For records with extra type data, like SOA, TXT, MX, CNAME, and NS there is a data attribute on Entities\DNSRecord that will be set with the proper type.

Reverse Lookup

This is offered via a separate ReverseDNSQuery interface as it is not common or available for every type of DNS Resolver. Only the LocalSystem Resolver implements it.

Observability

All provided resolvers have the ability to add subscribers and listeners. They are directly compatible with symfony/event-dispatcher

All events can be found here: src/Observability/Events

With a good idea of what a subscriber can do with them here: src/Observability/Subscribers

You could decide where you want to stream the events whether its to a log or somewhere else. The events are all safe to json_encode() without extra parsing.

If you want to see how easy it is to wire all this up, check out the repl bootstrap

Logging

All provided resolvers implement Psr\Log\LoggerAwareInterface and have a default NullLogger set at runtime.

Tinkering

Take a look in the Makefile for all the things you can do!

There is a very basic REPL implementation that wires up some Resolvers for you already and pipes events to sterr and stdout

make repl


All versions of php-dns with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-json Version *
ext-filter Version *
ext-intl Version *
ext-mbstring Version *
guzzlehttp/guzzle Version ^7.0 || ^6.0
psr/cache Version ^1.0 || ^2.0
symfony/event-dispatcher Version ^6.0 || ^5.0 || ^4.0 || ^3.0
psr/log Version ^1.0 || ^2.0 || ^3.0
guzzlehttp/promises Version ^1.3
spatie/dns Version ^2.0
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 remotelyliving/php-dns contains the following files

Loading the files please wait ....