{"id":27900548,"url":"https://github.com/hostinger/php-dig","last_synced_at":"2026-03-15T22:06:05.372Z","repository":{"id":79910691,"uuid":"74680209","full_name":"hostinger/php-dig","owner":"hostinger","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-29T08:56:13.000Z","size":42,"stargazers_count":12,"open_issues_count":1,"forks_count":14,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-05T20:17:02.256Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hostinger.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-24T14:26:45.000Z","updated_at":"2025-05-02T21:53:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"053a4683-b346-4056-93a6-48045f33f947","html_url":"https://github.com/hostinger/php-dig","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hostinger%2Fphp-dig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hostinger%2Fphp-dig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hostinger%2Fphp-dig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hostinger%2Fphp-dig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hostinger","download_url":"https://codeload.github.com/hostinger/php-dig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252569644,"owners_count":21769517,"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":"2025-05-05T20:17:06.955Z","updated_at":"2026-03-15T22:06:00.333Z","avatar_url":"https://github.com/hostinger.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-dig\n## Introduction\n\n[PHP DNS functions](http://php.net/manual/en/ref.network.php) don't have a timeout while the default timeout for dig is 5 seconds (with several (3) tries) \n\nIt should drastically decrease time to get dns records, and lower failure errors like `dns_get_record(): A temporary server error occurred.`\n\n## Installation\n\nFor now this package is not on [Packgist](https://packagist.org/), so you need to add it to your composer.json manually\n```json\n{\n    \"repositories\": [\n        {\n            \"type\": \"vcs\",\n            \"url\": \"git@github.com:hostinger/php-dig.git\"\n        }\n    ]\n}\n```\n\nInstall the latest version with\n```console\n$ composer require hostinger/php-dig\n```\n\n## Usage\n\n```php\n$client = new \\Hostinger\\Dig\\Client();\n$result = $client-\u003egetRecord('hostinger.com', DNS_MX);\n```\n\nThis is equal to \n```php\ndns_get_record('hostinger.com', DNS_MX);\n```\n\nPackage checks if it can run `exec` in server environment, otherwise it will fallback to dns_get_record().\n\n### DigClient implements LoggerAwareInterface\nYou can set [logger](https://github.com/Seldaek/monolog/) to debug / log package activity\n\n```php\n$client = new \\Hostinger\\Dig\\Client();\n$logger = new \\Monolog\\Logger\\Logger('App');\n$logger-\u003epushHandler(new StreamHandler('path/to/your.log'));\n$client-\u003esetLogger($logger);\n```\n\n## About\n\n### Requirements\n\n- php-dig client works with PHP 8.0 or above.\n\n### Submitting bugs and feature requests\n\nBugs and feature request are tracked on [GitHub](https://github.com/hostinger/php-dig/issues)\n\n\n## Sources\n- [Stack overflow question What would cause checkdnsrr() or dns_get_record() to take too long?](http://stackoverflow.com/questions/14065946/what-would-cause-checkdnsrr-or-dns-get-record-to-take-too-long)\n- [Reddit thread: dns_get_record suddenly running very slowly](https://www.reddit.com/r/PHP/comments/2k3ns7/dns_get_record_suddenly_running_very_slowly/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhostinger%2Fphp-dig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhostinger%2Fphp-dig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhostinger%2Fphp-dig/lists"}