verrucktua / dns-library
A PHP library for retrieving DNS records for a specified domain name
Requires
- php: ^8.0
- illuminate/support: ^9.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-05-15 11:32:33 UTC
README
This PHP library allows you to retrieve all DNS records for a specified domain name. It is designed to be used with the Laravel framework.
Requirements
- PHP version 8.0 or later
- Composer for dependency management
Installation
Open a terminal and navigate to your Laravel project directory.
Run the following command to install the library via Composer:
composer require phoenix/dns-library
Usage
-
Import the
DnsLibrary
class into your code:use DnsLibrary\DnsLibrary;
-
Create an instance of the
DnsLibrary
class:$dnsLibrary = new DnsLibrary();
-
Use the
getDnsRecords
method to retrieve all DNS records for a domain:$domain = 'example.com'; $records = $dnsLibrary->getDnsRecords($domain);
The
$records
variable will contain an array of DNS records. -
You can iterate over the records and perform any necessary operations:
foreach ($records as $record) { // Perform operations on each DNS record }
Examples
Retrieve DNS Records
use DnsLibrary\DnsLibrary;
$dnsLibrary = new DnsLibrary(); $domain = 'example.com'; $records = $dnsLibrary->getDnsRecords($domain);
foreach ($records as $record) { echo $record['host'] . ' ' . $record['type'] . ' ' . $record['target'] . "\n"; }
This example retrieves all DNS records for the example.com
domain and displays each record's host, type, and target.
Contributing
If you would like to contribute to this library, please follow these steps:
- Fork the repository on GitHub.
- Create a new branch for your feature or bug fix.
- Make your modifications and commit your changes.
- Push your branch to your forked repository.
- Submit a pull request to the main repository.
License
This library is open-source and available under the MIT License.
Credits
This library is developed and maintained by VerrucktUA.
Feel free to provide any feedback, suggestions, or bug reports. Contributions are welcome!
By following the instructions in the README.md file, users will be able to set up and use your library effectively. Make sure to update the placeholders with the relevant information and provide accurate instructions based on your library's implementation.