Download the PHP package stitch-digital/nametodomain-php-sdk without Composer
On this page you can find all versions of the php package stitch-digital/nametodomain-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stitch-digital/nametodomain-php-sdk
More information about stitch-digital/nametodomain-php-sdk
Files in stitch-digital/nametodomain-php-sdk
Package nametodomain-php-sdk
Short Description An SDK to easily work with the Name To Domain API
License MIT
Homepage https://github.com/stitch-digital/nametodomain-php-sdk
Informations about the package nametodomain-php-sdk
Name To Domain PHP SDK
This package is the official PHP SDK for the Name To Domain API, built with Saloon v3.
Behind the scenes, the SDK uses Saloon to make the HTTP requests.
Installation
To get started, we highly recommend reading the Name To Domain API documentation.
Quick Start
Usage
To authenticate, you'll need an API token. You can create one in the API Dashboard at Name To Domain.
Setting a timeout
By default, the SDK waits 10 seconds for a response. Override via the constructor (apiToken, baseUrl, requestTimeout):
Handling errors
The SDK will throw an exception if the API returns an error. For validation errors, the SDK will throw a ValidationException.
For all other errors, the SDK will throw a \NameToDomain\PhpSdk\Exceptions\NameToDomainException.
Resolve
The resolve endpoint allows you to resolve a single company name to its official website domain with a confidence score.
Resolve a company
You can use the resolve method to resolve a company name and country code to its domain.
The response includes the original input and the resolution result. If no reliable match is found, the domain and confidence will be null.
Resolve with emails
You can optionally pass email addresses for disambiguation:
Domain enrichment
Domain enrichment runs asynchronously and returns richer data (favicon, trust signals, web metadata, company classification, email provider hints, etc.). There are single-company and batch flows.
Enrich a single company
Create an enrichment job for one company. Poll enrichJob(jobId) for the result.
Enrich a single company with idempotency key
You can include an idempotency key to safely retry requests:
Enrich multiple companies (batch)
Create a batch enrichment job. Each item may include company, country, and optionally emails and identifier.
Enrich batch with idempotency key
Get a single enrich job
Use enrichJob to get a single-company enrichment job. The output field is only present when the job is completed.
Get a batch enrich job
Use enrichBatchJob to get a batch job with one page of output and pagination (when completed):
Get batch enrich job items (paginated)
The enrichBatchJobItems method returns a Saloon Paginator over all JobItem DTOs across pages.
Iterating over items
Using Laravel Collections
Custom pagination
Job item structure
Each JobItem includes:
id,identifier(client-supplied, if provided)input(company, country, email_domains)status,result,errorMessage,processedAt
The result array can contain company_normalized, domain, confidence, and for enrichment: favicon_url, trust, web_metadata, company_classification, email_provider_hints.
Pagination
The SDK uses Saloon's pagination plugin. The enrichBatchJobItems() method returns a Paginator that yields JobItem DTOs across pages. See Saloon pagination documentation for items(), collect(), and advanced usage.
Using Saloon requests directly
You can use the request classes directly for full control:
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.