{"id":16511193,"url":"https://github.com/danog/libdnsnative","last_synced_at":"2026-05-08T22:34:26.334Z","repository":{"id":56962175,"uuid":"196998827","full_name":"danog/LibDNSNative","owner":"danog","description":"Encoder/decoder for PHP's dns_get_record raw format based on libdns","archived":false,"fork":false,"pushed_at":"2019-08-25T18:45:49.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-12T20:13:14.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-15T12:56:09.000Z","updated_at":"2019-08-25T18:45:52.000Z","dependencies_parsed_at":"2022-08-21T05:40:21.251Z","dependency_job_id":null,"html_url":"https://github.com/danog/LibDNSNative","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danog%2FLibDNSNative","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danog%2FLibDNSNative/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danog%2FLibDNSNative/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danog%2FLibDNSNative/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danog","download_url":"https://codeload.github.com/danog/LibDNSNative/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241476435,"owners_count":19968916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T15:59:17.278Z","updated_at":"2026-05-08T22:34:26.288Z","avatar_url":"https://github.com/danog.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LibDNSNative\n\n[![Build Status](https://img.shields.io/travis/danog/libdnsnative/master.svg?style=flat-square)](https://travis-ci.org/danog/libdnsnative)\n![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)\n\n\nEncoder/decoder for the raw format of [PHP's dns_get_record function](https://www.php.net/manual/en/function.dns-get-record.php) based on [libdns](https://github.com/DaveRandom/LibDNS/): allows usage of the function to fetch **all kinds of DNS records**, not just the ones supported by the `DNS_` constants.  \n\nThe API consists of a `NativeEncoderFactory` that creates `NativeEncoder` objects, that can encode libdns `Message` objects to a list of parameters that that must be passed to the `dns_get_record` function.\n\nThe `NativeDecoderFactory` creates `NativeDecoder` objects, that accept the results of the `dns_get_record` function and decode them back to `Message` objects.  \n\n## Installation\n\n```\ncomposer require danog/libdns-native\n```\n\n## Usage\n\n```php\n\u003c?php\n\nrequire 'vendor/autoload.php';\n\nuse danog\\LibDNSNative\\NativeEncoderFactory;\nuse danog\\LibDNSNative\\NativeDecoderFactory;\nuse LibDNS\\Records\\QuestionFactory;\nuse LibDNS\\Records\\ResourceQTypes;\nuse LibDNS\\Messages\\MessageFactory;\nuse LibDNS\\Messages\\MessageTypes;\n\n$question = (new QuestionFactory)-\u003ecreate(ResourceQTypes::DNSKEY);\n$question-\u003esetName('daniil.it');\n\n$message = (new MessageFactory)-\u003ecreate(MessageTypes::QUERY);\n$records = $message-\u003egetQuestionRecords();\n$records-\u003eadd($question);\n\n$encoder = (new NativeEncoderFactory)-\u003ecreate();\n$question = $encoder-\u003eencode($message);\n\n$result = dns_get_record(...$question);\n\n$decoder = (new NativeDecoderFactory)-\u003ecreate();\n$result = $decoder-\u003edecode($result, ...$question);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanog%2Flibdnsnative","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanog%2Flibdnsnative","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanog%2Flibdnsnative/lists"}