PHPackages                             noglitchyo/dealdoh - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. noglitchyo/dealdoh

ActiveLibrary[HTTP &amp; Networking](/categories/http)

noglitchyo/dealdoh
==================

A simple DNS over HTTPS proxy built on PHP.

0.4.0-beta(5y ago)181463[1 issues](https://github.com/noglitchyo/dealdoh/issues)1MITPHPPHP ^7.3CI failing

Since Jun 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/noglitchyo/dealdoh)[ Packagist](https://packagist.org/packages/noglitchyo/dealdoh)[ RSS](/packages/noglitchyo-dealdoh/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (14)Versions (7)Used By (1)

Dealdoh
=======

[](#dealdoh)

> Play with DNS over HTTPS and much more!

Dealdoh is a DNS-over-HTTPS (DoH) proxy and a library around DNS messaging written in PHP.

[![PHP from Packagist](https://camo.githubusercontent.com/fcb97e30ed1a67e3c8c80144634d3aa28f83ebe2b3d0cd3a9f115ca72f8cdc4f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6e6f676c69746368796f2f6465616c646f682e737667)](https://camo.githubusercontent.com/fcb97e30ed1a67e3c8c80144634d3aa28f83ebe2b3d0cd3a9f115ca72f8cdc4f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6e6f676c69746368796f2f6465616c646f682e737667)[![Build Status](https://camo.githubusercontent.com/9a813dbaab1202305fcacb3fb8ea342fa80f0d0bd80a05af29a99de69605b7fb/68747470733a2f2f7472617669732d63692e6f72672f6e6f676c69746368796f2f6465616c646f682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/noglitchyo/dealdoh)[![codecov](https://camo.githubusercontent.com/9267ebe77a0edab66996ffd5713ccd107404e158b59742df536ba550ef3cff9d/68747470733a2f2f636f6465636f762e696f2f67682f6e6f676c69746368796f2f6465616c646f682f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/noglitchyo/dealdoh)[![Scrutinizer code quality (GitHub/Bitbucket)](https://camo.githubusercontent.com/946c9758841f18c41a6d9fd4c24a1104228525adde41a986eb1e6410fbd540a9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f6e6f676c69746368796f2f6465616c646f682e737667)](https://camo.githubusercontent.com/946c9758841f18c41a6d9fd4c24a1104228525adde41a986eb1e6410fbd540a9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f6e6f676c69746368796f2f6465616c646f682e737667)[![Packagist](https://camo.githubusercontent.com/ba2a991920f4f526ecd85fbfde2927635e141d497ba2fc5d1e00f777b84c903b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e6f676c69746368796f2f6465616c646f682e737667)](https://camo.githubusercontent.com/ba2a991920f4f526ecd85fbfde2927635e141d497ba2fc5d1e00f777b84c903b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e6f676c69746368796f2f6465616c646f682e737667)

Overview
--------

[](#overview)

This library gives ability to proxy DoH requests and/or to send DNS queries with standard UDP/TCP and various modern and secure DNS protocols like DNSCrypt, DNS-over-HTTPS (DoH), GoogleDNS.

It attempts to achieve the following goals:

- provide high-compatibility with a large variety of DNS protocols.
- provide a well-designed abstraction layer for development around DNS in PHP.

Features
--------

[](#features)

- DoH proxy middleware PSR-15/PSR-7 compliant.
- Create and forward DNS messages to different type of DNS upstream resolvers.
- Forward DNS query through multiple DNS upstream resolvers.
- Compatible with DNS protocols: RFC-1035 (Plain DNS over TCP/UDP), RFC-8484 (DoH), Google DoH API, DNSCrypt
- Abstraction layer around DNS development.
- Parse [DNS stamps](https://dnscrypt.info/stamps-specifications)

Client
------

[](#client)

[dealdoh-client](https://github.com/noglitchyo/dealdoh-client/) is a CLI utility which offers a ready-to-use implementation of this library to send and forward DNS queries.

Library
-------

[](#library)

#### Requirements

[](#requirements)

- PHP 7.3
- Web server
- Optional: HTTPS enabled with valid certificates (self-signed certificates can work but it depends of the DOH client making the queries)

#### Installation

[](#installation)

- Run `composer require noglitchyo/dealdoh`
- `DohResolverMiddleware::forward()` method consumes PSR-7 ServerRequest. Some compatible implementations which can be used:

    -  - `composer require nyholm/psr7`
    -  - `composer require guzzle/psr7`
    -  - `composer require zendframework/zend-diactoros`
- Configure your application to call `DohResolverMiddleware::forward()`
- Testing the installation

As recommended in RFC-8484, usually, DoH client/server will send/receive DNS requests on the path: `/dns-query`. Your application should be configured to listen on this route.

A large variety of DoH client exists than can be used to test the installation.

- [dealdoh-client](https://github.com/noglitchyo/dealdoh-client/)
- [Facebook Experimental](https://github.com/facebookexperimental/doh-proxy)
- Using client from Web Browser
    Mozilla Firefox provides a [Trusted Recursive Resolver](https://wiki.mozilla.org/Trusted_Recursive_Resolver) who can be configured to query DoH servers. [This article from Daniel Stenberg](https://daniel.haxx.se/blog/2018/06/03/inside-firefoxs-doh-engine/)provides a lot of details about TRR and how to configure it. Please check also [the browser implementations list](https://github.com/curl/curl/wiki/DNS-over-HTTPS#supported-in-browsers-and-clients).

#### Example

[](#example)

```
