Download the PHP package opusdns/php-client without Composer

On this page you can find all versions of the php package opusdns/php-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-client

OpusDNS PHP client

The official PHP client for the OpusDNS API: domain registration, transfers, renewals, contacts, DNS zones, email and domain forwarding, and everything else the API offers. The client is generated from the OpenAPI specification published in OpusDNS/api-spec, so every operation, model and enumeration of the API is available with full type information.

Requirements

Installation

Leave out guzzlehttp/guzzle if you provide your own PSR-18 client.

Quick start

Use Config::production() for the live API.

Configuration

Config::production($apiKey) and Config::sandbox($apiKey) are shortcuts for the two environments.

Every request carries the header X-OpusDNS-Client: opusdns-php-client/<version>.

Services

The API is grouped into services, one per tag of the specification. Each service is reached through an accessor on the client and has one method per operation, named after the operation id.

Accessor Service Covers
$client->domain() DomainService Registration, transfer, renewal, restore, update, deletion, availability checks, claims notices, DNSSEC at the registry, TLD-specific procedures
$client->contact() ContactService Registrant and other contacts, verification, attribute sets
$client->availability() AvailabilityService Bulk and streamed availability lookups
$client->domainSearch() DomainSearchService Name suggestions
$client->tld() TldService TLD specifications and portfolio
$client->host() HostService Host objects (glue records)
$client->dns() DnsService DNS zones, record sets, DNSSEC signing, zone summaries
$client->vanityNameservers() VanityNameserversService Vanity nameserver sets
$client->domainForward() DomainForwardService HTTP redirects
$client->emailForward() EmailForwardService Email forwarding
$client->parking() ParkingService Domain parking
$client->jobs() JobsService Asynchronous jobs and batches
$client->event() EventService Event history
$client->tag() TagService User tags
$client->archive() ArchiveService Archived objects
$client->report() ReportService Reports and downloads
$client->organization() OrganizationService Organization, credentials, pricing, billing
$client->user() UserService Users of the organization
$client->whitelabel() WhitelabelService White-label branding
$client->authentication() AuthenticationService Token and credential introspection
$client->aiConcierge() AiConciergeService AI concierge conversations

A few examples:

Method parameters follow the specification: path parameters first, then required query parameters and the request body, then optional query parameters. Optional parameters left at null are not sent. Named arguments keep calls readable:

Models

Every request and response schema is a final readonly class in OpusDNS\Client\Model, and every enumeration is a backed enum in OpusDNS\Client\Enum.

Pagination

Listing methods return a page model that implements Page: results() gives the items of that page and pagination() the metadata (currentPage, totalPages, totalItems, hasNextPage). Paginator walks all pages by calling your closure with successive page numbers.

Iteration stops when the API reports no further page, when the last page number is reached, when a page comes back empty, or after maxPages pages.

Errors

All exceptions extend OpusDNS\Client\Exception\OpusDnsException, which extends RuntimeException.

Exception Raised when
NetworkException No response arrived: DNS, TLS, connection or timeout failure
HttpException The API answered with a 4xx or 5xx status
BadRequestException 400
UnauthorizedException 401, usually a missing or invalid API key
ForbiddenException 403, the key lacks a required permission
NotFoundException 404
ConflictException 409, for example registering a name that is already registered
ValidationException 422; messages() lists the failing fields as field.path: message
RateLimitException 429; retryAfter() gives the seconds to wait when the API sends Retry-After
ServerException Any 5xx
DecodingException A successful response could not be decoded or hydrated into its model

The status exceptions extend HttpException, which exposes statusCode(), the problem details the API sends (problemType, problemTitle, problemDetail), the decoded body, and the PSR-7 request and response. The stored request carries no X-Api-Key header.

Testing your integration

OpusDNS\Client\Testing\FakeHttpClient is a PSR-18 client that records requests and answers from a queue, so code using this client can be tested without the network:

queue() accepts any PSR-7 response or a throwable to simulate a transport failure. An empty queue answers 200 with an empty JSON object.

Lower-level access

Client::request() sends any request with the configured authentication and returns the PSR-7 response. Endpoint holds every path template of the API, and Permission::required() tells which permissions the API key needs for an operation.

Development

Layout

Path Contents
src/Client.php, Config.php, Serializer.php, Union.php, Paginator.php, ApiModel.php, src/Exception/ Hand-written runtime
src/Model/, src/Enum/, src/Service/, src/Endpoint.php, src/Permission.php Generated from the specification; each file says so in its header
generator/ The generator, built on nette/php-generator; a development dependency only
spec/openapi.yaml The specification the generated code was produced from
spec/version.yaml The api-spec commit and version that specification was taken from
tests/ PHPUnit tests, including a fixture specification that exercises the generator end to end

Examples

examples/ holds scripts that run against the sandbox and print what happens: registering, renewing and updating a domain. They read the key from the OPUSDNS_API_KEY environment variable or from a .env file in the repository root; copy .env.example to .env and fill in a sandbox key.

Commands

Updating to a new specification

Run composer spec:sync, then composer generate, composer test and composer stan, and review the diff of src/. New operations, models and enum values appear automatically; removed or renamed ones are a breaking change for consumers. Regenerate whenever the API adds enum values: hydration is strict, so a client built from an older specification keeps values it has never seen as raw strings.

The "Spec update" workflow does the same on a weekly schedule and on manual runs: it syncs the specification, regenerates, runs the checks and opens a pull request when anything changed. The "CI" workflow verifies on every push and pull request that src/ matches the committed specification and that the checks pass.

Releasing

Merging a pull request into main releases: the "Release" workflow runs the checks, bumps the version from the latest tag, pushes the new tag and creates the GitHub release with generated notes. The pull request's label picks the bump: major, minor or patch, with patch when no label is set; a no-release label skips the release. The same workflow can be run by hand with the bump chosen from a dropdown. Packagist picks the tag up through its GitHub hook.

How the generator maps the specification

Specification PHP
Object schema final readonly class with promoted public properties, fromArray() and toArray()
Enum schema Backed enum; case names are upper snake case, values starting with a digit get a leading underscore
anyOf with null Nullable type
Union of objects PHP union type, resolved by discriminator or by required keys
array, additionalProperties array, documented as list<T> or array<string, T>
date-time, date \DateTimeImmutable
default, const Constructor default values
Operation Method on the tag's Service\*Service class, named from the operation id
Path Constant on Endpoint
x-required-permissions Permission::REQUIRED and a line in the method docblock

License

Released under the MIT License. See LICENSE for the full text.


All versions of php-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-json Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package opusdns/php-client contains the following files

Loading the files please wait ...