PHPackages                             artem-baranovskyi/dns-lookup - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. artem-baranovskyi/dns-lookup

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

artem-baranovskyi/dns-lookup
============================

This test standalone Laravel library allows to get all DNS records for the specified domain name.

1.0.3(3y ago)06MITPHPPHP ^8.2

Since Jun 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ArtemBaranovsky/dns-lookup)[ Packagist](https://packagist.org/packages/artem-baranovskyi/dns-lookup)[ RSS](/packages/artem-baranovskyi-dns-lookup/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (3)Versions (4)Used By (0)

DnsLookup Library
=================

[](#dnslookup-library)

The DnsLookup library is a PHP package that provides DNS lookup functionality. It allows you to retrieve DNS records for a given domain name in various output formats.

Requirements &amp; Dependencies
-------------------------------

[](#requirements--dependencies)

```
"php": "^8.2",
"monolog/monolog": "^3.0"

```

Installation
------------

[](#installation)

You can install the library using Composer. Run the following command in your project directory:

```
composer require artem-baranovskyi/dns-lookup
```

Then add package Service Provider to autoload in config/app.php:

```
        /*
         * Package Service Providers...
         */
        DnsLookupServiceProvider::class,
```

Also add package alias at Class Aliases section:

```
    'aliases' => Facade::defaultAliases()->merge([
        'DnsLookup' => ArtemBaranovskyi\DnsLookup\Facades\DnsLookupFacade::class,
    ])->toArray(),
```

Usage
-----

[](#usage)

To use the DnsLookup library, you can follow these options:

1. Use DnsLookup as a facade, providing desired output format:

```
use ArtemBaranovskyi\DnsLookup\Facades\DnsLookupFacade;
...
    $domain = 'example.com';
    $dnsRecords = DnsLookupFacade::getDnsRecords($domain, 'array'); // use any from 'array', 'collection', 'json'
    dd($dnsRecords);
```

2. Get an instance of DnsLookup form Service Container, providing desired output format:

```
use ArtemBaranovskyi\DnsLookup\Facades\DnsLookupFacade;

    $domain = 'example.com';
    $dnsLookup = app(DnsLookup::class);
    $dnsRecords = $dnsLookup->getDnsRecords($domain, 'array'); // use any from 'array', 'collection', 'json'
    dd($dnsRecords);
```

Available Output Formats
------------------------

[](#available-output-formats)

The getDnsRecords method accepts a format parameter, which determines the output format of the DNS records. The following formats are supported:

```
array: Returns an array of DNS records (default format)
collection: Returns a DnsRecordCollection object containing the DNS records.
json: Returns a JSON-encoded string of the DNS records.

```

Error Handling
--------------

[](#error-handling)

If an error occurs during the DNS lookup process, an Exception will be thrown with an error message. It's recommended to wrap the getDnsRecords call in a try-catch block to handle any potential exceptions:

```
try {
    $dnsRecords = $dnsLookup->getDnsRecords($domain, $format);
    // Use the DNS records
} catch (Exception $e) {
    echo "An error occurred: " . $e->getMessage();
}
```

Contributing
------------

[](#contributing)

Contributions to the DnsLookup library are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request on [GitHub](https://github.com/your-username/dns-lookup).

License
-------

[](#license)

This library is open source and licensed under the MIT License.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

1109d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d0fe7a7976782f0756af2fdcef800edf34152fc031b49914a46eecf2d766550?d=identicon)[ArtemBaranovsky](/maintainers/ArtemBaranovsky)

---

Top Contributors

[![ArtemBaranovsky](https://avatars.githubusercontent.com/u/30216590?v=4)](https://github.com/ArtemBaranovsky "ArtemBaranovsky (29 commits)")

---

Tags

dnsdns lookup

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/artem-baranovskyi-dns-lookup/health.svg)

```
[![Health](https://phpackages.com/badges/artem-baranovskyi-dns-lookup/health.svg)](https://phpackages.com/packages/artem-baranovskyi-dns-lookup)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[laravel/nightwatch

The official Laravel Nightwatch package.

36210.1M36](/packages/laravel-nightwatch)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
