Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gaalferov/ext-domain-connect

PHP extension(package) to work with Domain Connect (an open standard that makes it easy for a user to configure DNS)
https://github.com/gaalferov/ext-domain-connect

dns-settings domainconnect godaddy godaddy-dns godaddy-dns-records

Last synced: 2 months ago
JSON representation

PHP extension(package) to work with Domain Connect (an open standard that makes it easy for a user to configure DNS)

Awesome Lists containing this project

README

        

PHP extension for Domain Connect
===============
![GitHub Actions](https://github.com/gaalferov/ext-domain-connect/actions/workflows/ci-phpunit.yml/badge.svg)
![GitHub Actions](https://github.com/gaalferov/ext-domain-connect/actions/workflows/ci-php-cs-fixer.yml/badge.svg)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/1df868212d224c8589005c2e8aee7e45)](https://app.codacy.com/gh/gaalferov/ext-domain-connect/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)

[![PHP version support](https://img.shields.io/packagist/dependency-v/gaalferov/php-ext-domain-connect/php?style=flat)](https://packagist.org/packages/gaalferov/php-ext-domain-connect)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/gaalferov/php-ext-domain-connect.svg?style=flat)](https://packagist.org/packages/gaalferov/php-ext-domain-connect)
[![Total Downloads](https://img.shields.io/packagist/dt/gaalferov/php-ext-domain-connect.svg?style=flat)](https://packagist.org/packages/gaalferov/php-ext-domain-connect)

PHP client library for Domain Connect protocol.
For details of the protocol, please visit: https://domainconnect.org
Library offers Service Provider functionality in Sync mode.

## Specification reference
https://github.com/Domain-Connect/spec/blob/master/Domain%20Connect%20Spec%20Draft.adoc

## DC Templates
https://github.com/Domain-Connect/Templates/tree/master

## Install
```bash
composer require gaalferov/php-ext-domain-connect
```

## Usage

### Sync flow

Just get the link. Discovery and template query part is solved automatically.
```php
getTemplateSyncUrl(
'domainconnect.org', // domain name
'exampleservice.domainconnect.org', // providerId from the template
'template1', // serviceId from the template
[
'IP' => '132.148.25.185',
'RANDOMTEXT' => 'shm:1531371203:Hello world sync',
'redirect_uri' => 'https://your-client-page.com',
'state' => 'someState'
],
);

print_r($applyUrl);
} catch (DomainConnectException $e) {
echo (sprintf('An error has occurred: %s', $e->getMessage()));
}

```

Output:
```text
https://dcc.godaddy.com/manage/v2/domainTemplates/providers/exampleservice.domainconnect.org/services/template1/apply?domain=domainconnect.org&IP=132.148.25.185&RANDOMTEXT=shm%3A1531371203%3AHello+world+sync&redirect_uri=https%3A%2F%2Fyour-client-page.com&state=someState

```

### Sync flow with signed request

```php
getTemplateSyncUrl(
'domainconnect.org', // domain name
'exampleservice.domainconnect.org', // providerId from the template
'template1', // serviceId from the template
[
'IP' => '132.148.25.185',
'RANDOMTEXT' => 'shm:1531371203:Hello world sync',
'redirect_uri' => 'https://your-client-page.com',
'state' => 'someState'
],
$privateKey,
$keyId
);

print_r($applyUrl);
} catch (DomainConnectException $e) {
echo (sprintf('An error has occurred: %s', $e->getMessage()));
}

```

Output:
```text
https://domainconnect.1and1.com/sync/v2/domainTemplates/providers/exampleservice.domainconnect.org/services/template1/apply?domain=connect.domains&host=foo&IP=132.148.25.185&RANDOMTEXT=shm%3A1531371203%3AHello+world+sync&redirect_uri=http%3A%2F%2Fexample.com&state=someState&sig=HOoCBTFNIjWK3Qjy7CtWLB9HOcVvaGYFD3XsaI%2BZm%2BHtm%2FgsK66kfEfbi7Y8uoNOAbJXx3xfnbKrdASNa%2FPjQQKLk11NV%2BLNf3iDwkg7cOV9l54L2PqHFymOgu%2BiXr3I5aUkmA%2F19YAqiz3VJrh3K1XGeqc100cyZo%2BWq90bVcyWGVhIf5vYZEsU%2FzprckhmQdipqFfAB6XB4i72RzdxCKpBUFsyWcWYX80cz873pLN42uV%2BwGFUhSQ0qDC8d60n5m1f8h9Fdmik6%2FD%2BnmPpfK4Ge%2BHGnnq%2FpvR3nb95x9DKDHOd%2BfaIVcLhIZEbbVxIa57bGH%2FRUQiMbApBqkM4YQ%3D%3D&key=_dck1
```

### Request Options (guzzle)
```php
[
'http' => 'tcp://localhost:8125',
'https' => 'tcp://localhost:9124',
'no' => ['.mit.edu', 'foo.com']
]
]);

$applyUrl = $templateService->getTemplateSyncUrl(
'domainconnect.org',
'exampleservice.domainconnect.org',
'template1',
[
'IP' => '132.148.25.185',
'RANDOMTEXT' => 'shm:1531371203:Hello world sync',
'redirect_uri' => 'http://example.com',
'state' => 'someState'
],
);

print_r($applyUrl);
} catch (DomainConnectException $e) {
echo (sprintf('An error has occurred: %s', $e->getMessage()));
}

```

## Tests
To run tests use next command: `composer tests` or `php vendor/bin/phpunit ./tests`