PHPackages                             automattic/domain-services-client - 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. [API Development](/categories/api)
4. /
5. automattic/domain-services-client

ActiveLibrary[API Development](/categories/api)

automattic/domain-services-client
=================================

Client library for Automattic's Domain Services API.

1.6.3(1y ago)5513[1 issues](https://github.com/Automattic/domain-services-client/issues)[2 PRs](https://github.com/Automattic/domain-services-client/pulls)1GPL-2.0-or-laterPHPPHP &gt;=7.4.0CI passing

Since Dec 23Pushed 10mo ago6 watchersCompare

[ Source](https://github.com/Automattic/domain-services-client)[ Packagist](https://packagist.org/packages/automattic/domain-services-client)[ RSS](/packages/automattic-domain-services-client/feed)WikiDiscussions trunk Synced 3w ago

READMEChangelogDependencies (8)Versions (40)Used By (1)

Client

Client code for Automattic's Domain Services.

---

Purpose
-------

[](#purpose)

This library is used to connect a php client to Automattic's domain management service. It is currently only intended for use by applications hosted by Automattic and will not work for other use cases.

Installation &amp; Usage
------------------------

[](#installation--usage)

### Requirements

[](#requirements)

- PHP 7.4 and later. (Should also work with PHP 8.0.)
- Also requires an Http client compatible with [PSR-18's ClientInterface implementation](https://www.php-fig.org/psr/psr-18/#clientinterface).

### Adding the library to your code

[](#adding-the-library-to-your-code)

As mentioned in the [requirements](#requirements) above, the package expects a PSR-18 compatible HTTP client. There is a list of available HTTP clients with that implementation [available here](https://packagist.org/providers/psr/http-client-implementation). Below are instructions for both [Guzzle 6](#guzzle-6) and [Guzzle 7](#guzzle-7) as an example.

#### Guzzle 7

[](#guzzle-7)

- Guzzle 7 implements both `PSR-18` and `PSR-17` standards. This makes it ready to work with the client library directly.
- To require this library and Guzzle 7 (if it's not already), the full command should look something like that: ```
    composer require automattic/domain-services-client guzzlehttp/guzzle

    ```
- Once this is done, make sure to require the composer autoload file `vendor/autoload.php` in your code if it's not already.
- You can see an example of the code [here](./dev-tools/examples/guzzle-7.php)

#### Guzzle 6

[](#guzzle-6)

- Guzzle 6 does not implement PSR-18 `ClientInterface`, therefore you will need to use an adapter for it. One of the most common adapters for that is [php-http/guzzle6-adapter](https://packagist.org/packages/php-http/guzzle6-adapter) package.
- Guzzle 6 also does implement [PSR-17](https://www.php-fig.org/psr/psr-17/) HTTP Factories. There are many packages to choose from, but for this example, we will be using [http-interop/http-factory-guzzle](https://packagist.org/packages/http-interop/http-factory-guzzle)
- The full command should look something like that: ```
    composer require automattic/domain-services-client php-http/guzzle6-adapter http-interop/http-factory-guzzle

    ```
- Once this is done, make sure to require the composer autoload file `vendor/autoload.php` in your code if it's not already.
- You can see an example of the code [here](./dev-tools/examples/guzzle-6.php)

---

Getting Started
---------------

[](#getting-started)

Please follow the [installation procedure](#installation--usage) and then run the following:

```
