kowap / namecheap-php
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/kowap/namecheap-php
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.10
This package is not auto-updated.
Last update: 2025-12-01 14:01:08 UTC
README
A modern, clean, PSR-4 compatible PHP SDK for working with the Namecheap API.
Supports production and sandbox environments, domain operations, bulk checks, pricing with caching, DTO-based responses, and balance retrieval.
This SDK is designed to be simple, predictable, and developer-friendly.
Features
- Fully PSR-4 structured
- Production and Sandbox API modes
- Get account balance
- Get list of owned domains (with pagination)
- Check domain availability
- Get domain registration prices
- Bulk domain availability checks
- Bulk domain checks with pricing
- Pricing cache (24h)
- DTO-based responses
Installation
Install via Composer:
composer require kowap/namecheap-php
Usage Example
Initialize the client
use kowap\Namecheap\NamecheapClient; $client = new NamecheapClient( apiUser: 'YOUR_API_USER', apiKey: 'YOUR_API_KEY', username: 'YOUR_USERNAME', clientIp: 'YOUR_IP', sandbox: false );
Get Account Balance
$balance = $client->users()->getBalance(); echo $balance->availableBalance; echo $balance->currency;
Get Domains List
$list = $client->domains()->getList([ 'Page' => 1, 'PageSize' => 100, ]); foreach ($list->items as $item) { echo $item->domain . PHP_EOL; }
DomainListResult DTO
DomainListResult {
items: DomainListItem[]
total: 53
page: 1
pageSize: 100
}
Check Domain Availability
$result = $client->domains()->checkWithPrice('example.com'); echo $result->domain; echo $result->available; echo $result->price;
DomainCheckResult DTO
DomainCheckResult {
domain: "example.com"
available: true
premium: false
price: 11.28
currency: "USD"
}
Bulk Domain Check
$domains = [ 'mytestdomain123.com', 'supertest987.net', 'helloexample.org' ]; $results = $client->domains()->checkManyWithPrice($domains); foreach ($results as $r) { echo $r->domain . ' → ' . ($r->available ? 'Available' : 'Taken') . PHP_EOL; }