PHPackages                             ljpc/laravel-cloudns - 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. ljpc/laravel-cloudns

ActiveLibrary[API Development](/categories/api)

ljpc/laravel-cloudns
====================

Laravel package for ClouDNS API integration with full support for DNS management and monitoring

1.0.2(10mo ago)1414MITPHPPHP ^8.3

Since Jul 8Pushed 10mo agoCompare

[ Source](https://github.com/LJPc-solutions/laravel-cloudns-library)[ Packagist](https://packagist.org/packages/ljpc/laravel-cloudns)[ RSS](/packages/ljpc-laravel-cloudns/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (9)Versions (4)Used By (0)

Laravel ClouDNS Library
=======================

[](#laravel-cloudns-library)

[![PHP Version](https://camo.githubusercontent.com/89899a77bdce65fc4c3d3423dfacff9c6461066a0b5354dc18d7721c23ba596e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d626c75652e737667)](https://www.php.net)[![Laravel Version](https://camo.githubusercontent.com/1cf7e76377e33c525ce7f5645f062caa61e32d7f2a143fa261c5cbce90820e67/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31312e782d7265642e737667)](https://laravel.com)[![Code Coverage](https://camo.githubusercontent.com/49ae47861bbad632a9a4da6f14dd176364d0ea24fd807965e861c6ffb27e9b30/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d39332e37352532352d627269676874677265656e2e737667)](https://github.com/ljpc/laravel-cloudns)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

[![Buy Me A Coffee](https://camo.githubusercontent.com/8bd3ccfc24697740a514437b301e19057ace3c1be9903d755eef2891228bffc6/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f76322f64656661756c742d6f72616e67652e706e67)](https://www.buymeacoffee.com/Lars-)

A comprehensive Laravel package for interacting with the ClouDNS API. This library provides a fluent, Laravel-friendly interface to manage DNS zones, records, monitoring, failover, GeoDNS, and more.

Features
--------

[](#features)

✨ **Complete API Coverage**

- 🌐 DNS Zone Management
- 📝 DNS Record Management
- 🔄 Dynamic DNS Support
- 🌍 GeoDNS Functionality
- 🔁 Failover Configuration
- 📊 Monitoring Services
- 📧 Mail Forwarding
- 🔗 AXFR/Slave Zones
- 🔧 SOA Settings
- 📈 Statistics &amp; Reports

🚀 **Laravel Integration**

- Service Provider with auto-discovery
- Facade for easy access
- Configuration file
- Dependency injection support
- Laravel 11.x compatible

🛡️ **Enterprise Ready**

- PHP 8.3+ with full type safety
- Comprehensive error handling
- Retry logic with exponential backoff
- Request/response caching
- Detailed logging
- 97% test coverage

Requirements
------------

[](#requirements)

- PHP 8.3 or higher
- Laravel 11.x
- Guzzle HTTP Client 7.8+

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require ljpc/laravel-cloudns
```

### Configuration

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --provider="LJPc\ClouDNS\ClouDNSServiceProvider" --tag="config"
```

Configure your ClouDNS credentials in `.env`:

```
CLOUDNS_AUTH_ID=your-auth-id
CLOUDNS_AUTH_PASSWORD=your-auth-password
CLOUDNS_IS_SUB_USER=false
CLOUDNS_USE_SUB_USERNAME=false

# Optional configuration
CLOUDNS_CACHE_ENABLED=true
CLOUDNS_CACHE_TTL=3600
CLOUDNS_LOG_ENABLED=true
CLOUDNS_LOG_CHANNEL=cloudns
```

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use LJPc\ClouDNS\Facades\ClouDNS;

// Account operations
$balance = ClouDNS::account()->getBalance();
$info = ClouDNS::account()->getInfo();
$stats = ClouDNS::account()->getStatistics();
```

### Using Dependency Injection

[](#using-dependency-injection)

```
use LJPc\ClouDNS\ClouDNS;

class DnsController extends Controller
{
    public function __construct(
        private readonly ClouDNS $cloudns
    ) {}

    public function index()
    {
        $zones = $this->cloudns->zone()->list();
        return view('dns.index', compact('zones'));
    }
}
```

Available Services
------------------

[](#available-services)

### 1. Account Service

[](#1-account-service)

Manage your ClouDNS account:

```
// Test authentication
$isValid = ClouDNS::account()->testLogin();

// Get current IP address
// Note: This may not be available for all account types
$ip = ClouDNS::account()->getCurrentIp();

// Get account balance
$balance = ClouDNS::account()->getBalance();

// Get account information
// Note: This may not be available for all account types
$info = ClouDNS::account()->getInfo();

// Get usage statistics
$stats = ClouDNS::account()->getStatistics();

// Check if authenticated
$authenticated = ClouDNS::account()->isAuthenticated();
```

### 2. Zone Service

[](#2-zone-service)

Manage DNS zones:

```
use LJPc\ClouDNS\Enums\ZoneType;
use LJPc\ClouDNS\Enums\RowsPerPage;

// List zones with pagination
$zones = ClouDNS::zone()->list(
    page: 1,
    rowsPerPage: RowsPerPage::FIFTY,
    search: 'example'
);

// Create a new zone (using array)
$zone = ClouDNS::zone()->create([
    'domain_name' => 'example.com',
    'zone_type' => ZoneType::MASTER->value,
    'master_ip' => '192.0.2.1' // for slave zones
]);

// Or using the DTO
use LJPc\ClouDNS\DTOs\Requests\CreateZoneRequest;
$zone = ClouDNS::zone()->create(
    new CreateZoneRequest(
        domainName: 'example.com',
        zoneType: ZoneType::MASTER,
        masterIp: '192.0.2.1' // for slave zones
    )
);

// Get zone information
$info = ClouDNS::zone()->getInfo('example.com');

// Get zone statistics
$stats = ClouDNS::zone()->getStatistics('example.com');

// Delete a zone
ClouDNS::zone()->delete('example.com');

// Update zone status
ClouDNS::zone()->updateStatus('example.com', true);

// Check if zone exists
$exists = ClouDNS::zone()->exists('example.com');

// Get all zones (auto-pagination)
$allZones = ClouDNS::zone()->getAll(search: 'example');
```

### 3. Record Service

[](#3-record-service)

Manage DNS records:

```
use LJPc\ClouDNS\Enums\RecordType;
use LJPc\ClouDNS\Enums\TTL;

// List records
$records = ClouDNS::record()->list('example.com');

// Create a new record (using array)
$recordId = ClouDNS::record()->create([
    'domain_name' => 'example.com',
    'record_type' => RecordType::A->value,
    'host' => 'www',
    'record' => '192.0.2.1',
    'ttl' => TTL::FIFTEEN_MINUTES->value
]);

// Or using the DTO
use LJPc\ClouDNS\DTOs\Requests\CreateRecordRequest;
$recordId = ClouDNS::record()->create(
    new CreateRecordRequest(
        domainName: 'example.com',
        recordType: RecordType::A,
        host: 'www',
        record: '192.0.2.1',
        ttl: TTL::FIFTEEN_MINUTES->value
    )
);

// Update a record
ClouDNS::record()->update(
    domainName: 'example.com',
    recordId: 12345,
    updates: [
        'host' => 'www',
        'record' => '192.0.2.2',
        'ttl' => TTL::ONE_HOUR->value
    ]
);

// Delete a record
ClouDNS::record()->delete('example.com', 12345);

// Copy records between zones
$copiedCount = ClouDNS::record()->copy(
    fromDomain: 'example.com',
    toDomain: 'example.org',
    deleteCurrentRecords: true
);

// Import records from file or string
$imported = ClouDNS::record()->import(
    domainName: 'example.com',
    content: $zoneFileContent,
    format: 'bind', // optional, defaults to 'bind'
    deleteExistingRecords: false,
    recordTypes: [] // optional array of record types to import
);

// Export records
$exported = ClouDNS::record()->export('example.com');

// Delete multiple records
$deleted = ClouDNS::record()->deleteMultiple('example.com', [123, 456, 789]);
```

### 4. Dynamic DNS Service

[](#4-dynamic-dns-service)

Manage Dynamic DNS:

```
// Get dynamic URL
$url = ClouDNS::dynamicDNS()->getDynamicUrl('example.com', 12345);

// Disable dynamic URL
ClouDNS::dynamicDNS()->disableDynamicUrl('example.com', 12345);

// Change dynamic URL
$newUrl = ClouDNS::dynamicDNS()->changeDynamicUrl('example.com', 12345);

// Update IP address
ClouDNS::dynamicDNS()->updateIp($dynamicUrl, '192.0.2.1');

// Get update history
$history = ClouDNS::dynamicDNS()->getHistory(
    domainName: 'example.com',
    recordId: 12345,
    page: 1,
    rowsPerPage: RowsPerPage::TWENTY
);

// Check if dynamic DNS is enabled
$enabled = ClouDNS::dynamicDNS()->isEnabled('example.com', 12345);
```

### 5. GeoDNS Service

[](#5-geodns-service)

Manage GeoDNS locations:

```
// Get available locations
$locations = ClouDNS::geoDNS()->getLocations('example.com');

// Check if GeoDNS is available
$available = ClouDNS::geoDNS()->isAvailable('example.com');
```

### 6. Failover Service

[](#6-failover-service)

Manage failover settings:

```
// Activate failover
ClouDNS::failover()->activate('example.com', 12345);

// Deactivate failover
ClouDNS::failover()->deactivate('example.com', 12345);
```

### 7. Mail Forwarding Service

[](#7-mail-forwarding-service)

Manage email forwarding:

```
// List mail forwards
$forwards = ClouDNS::mailForwarding()->list('example.com');

// Add mail forward
ClouDNS::mailForwarding()->add(
    domainName: 'example.com',
    box: 'info',
    host: 'example.com',
    destination: 'forward@example.org'
);

// Delete mail forward
ClouDNS::mailForwarding()->delete('example.com', 12345);
```

### 8. Monitoring Service

[](#8-monitoring-service)

Manage monitoring checks:

```
use LJPc\ClouDNS\Enums\MonitoringType;

// Create monitoring check
$monitor = ClouDNS::monitoring()->create([
    'name' => 'Web Server Check',
    'monitoring_type' => MonitoringType::HTTP,
    'ip' => '192.0.2.1',
    'check_period' => 300,
    'port' => 80,
    'path' => '/health',
    'timeout' => 10
]);

// List monitoring checks
$monitors = ClouDNS::monitoring()->list();

// Delete monitoring check
ClouDNS::monitoring()->delete(12345);
```

### 9. AXFR Service

[](#9-axfr-service)

Manage AXFR allowed IPs:

```
// Add allowed IP
ClouDNS::axfr()->addIp('example.com', '192.0.2.0/24');

// Remove allowed IP
ClouDNS::axfr()->removeIp('example.com', '192.0.2.0/24');

// List allowed IPs
$ips = ClouDNS::axfr()->listIps('example.com');
```

### 10. Slave Zone Service

[](#10-slave-zone-service)

Manage slave zone master servers:

```
// Add master server
ClouDNS::slaveZone()->addMasterServer('example.com', '192.0.2.1');

// Delete master server
ClouDNS::slaveZone()->deleteMasterServer('example.com', '192.0.2.1');

// List master servers
$servers = ClouDNS::slaveZone()->listMasterServers('example.com');
```

### 11. SOA Service

[](#11-soa-service)

Manage Start of Authority (SOA) settings:

```
// Get SOA details
$soa = ClouDNS::soa()->getDetails('example.com');

// Modify SOA settings
ClouDNS::soa()->modify(
    domainName: 'example.com',
    updates: [
        'primary_ns' => 'ns1.example.com',
        'admin_mail' => 'admin@example.com',
        'refresh' => 7200,
        'retry' => 1800,
        'expire' => 1209600,
        'default_ttl' => 3600
    ]
);

// Reset SOA to defaults
ClouDNS::soa()->reset('example.com');
```

### 12. Utility Service

[](#12-utility-service)

Utility functions:

```
// Get available TTLs
$ttls = ClouDNS::utility()->getAvailableTTLs();

// Get available record types for a zone type
$types = ClouDNS::utility()->getAvailableRecordTypes('master');

// Create failover webhook
$webhook = ClouDNS::utility()->createFailoverWebhook(
    domainName: 'example.com',
    recordId: 12345,
    type: 'HTTP',
    webhookUrl: 'https://example.com/webhook'
);
```

### 13. DNSSEC Service

[](#13-dnssec-service)

Manage DNSSEC (Domain Name System Security Extensions):

```
// Check if DNSSEC is available for a domain
$available = ClouDNS::dnssec()->isAvailable('example.com');

// Activate DNSSEC
ClouDNS::dnssec()->activate('example.com');

// Get DS records (for parent zone)
$dsRecords = ClouDNS::dnssec()->getDsRecords('example.com');
// Returns:
// [
//     'status' => 'Success',
//     'ds' => [
//         [
//             'digest_type' => 2,    // SHA-256
//             'algorithm' => 8,      // RSA/SHA-256
//             'digest' => '1234567890ABCDEF...',
//             'key_tag' => 12345
//         ]
//     ]
// ]

// Check if DNSSEC is active
$active = ClouDNS::dnssec()->isActive('example.com');

// Get comprehensive DNSSEC status
$status = ClouDNS::dnssec()->getStatus('example.com');
// Returns:
// [
//     'available' => true,
//     'active' => true,
//     'ds_records' => [...]
// ]

// Add DS record from parent zone
ClouDNS::dnssec()->addDsRecord(
    domainName: 'example.com',
    keyTag: 12345,
    algorithm: 8,      // RSA/SHA-256
    digestType: 2,     // SHA-256
    digest: '1234567890ABCDEF...'
);

// Remove DS record
ClouDNS::dnssec()->removeDsRecord('example.com', 12345);

// Remove all DS records
ClouDNS::dnssec()->removeDsRecord('example.com');

// Set DNSSEC OPTOUT status
ClouDNS::dnssec()->setOptOut('example.com', false); // Disable OPTOUT

// Deactivate DNSSEC
ClouDNS::dnssec()->deactivate('example.com');

// Get available DNSSEC algorithms
$algorithms = ClouDNS::dnssec()->getAvailableAlgorithms();
// Returns:
// [
//     5 => 'RSA/SHA-1',
//     7 => 'RSASHA1-NSEC3-SHA1',
//     8 => 'RSA/SHA-256',
//     10 => 'RSA/SHA-512',
//     13 => 'ECDSA Curve P-256 with SHA-256',
//     14 => 'ECDSA Curve P-384 with SHA-384'
// ]
```

Working with Enums
------------------

[](#working-with-enums)

The package uses PHP 8.3 enums for type safety:

```
use LJPc\ClouDNS\Enums\RecordType;
use LJPc\ClouDNS\Enums\TTL;
use LJPc\ClouDNS\Enums\ZoneType;
use LJPc\ClouDNS\Enums\MonitoringType;
use LJPc\ClouDNS\Enums\RowsPerPage;

// Record types
RecordType::A;          // IPv4 address
RecordType::AAAA;       // IPv6 address
RecordType::MX;         // Mail exchange
RecordType::CNAME;      // Canonical name
RecordType::TXT;        // Text record
RecordType::NS;         // Name server
RecordType::SRV;        // Service record
RecordType::CAA;        // Certificate authority
// ... and more

// TTL values
TTL::ONE_MINUTE;        // 60 seconds
TTL::FIVE_MINUTES;      // 300 seconds
TTL::FIFTEEN_MINUTES;   // 900 seconds
TTL::THIRTY_MINUTES;    // 1800 seconds
TTL::ONE_HOUR;          // 3600 seconds
TTL::THREE_HOURS;       // 10800 seconds
TTL::SIX_HOURS;         // 21600 seconds
TTL::TWELVE_HOURS;      // 43200 seconds
TTL::ONE_DAY;           // 86400 seconds
TTL::TWO_DAYS;          // 172800 seconds
TTL::THREE_DAYS;        // 259200 seconds
TTL::ONE_WEEK;          // 604800 seconds
TTL::TWO_WEEKS;         // 1209600 seconds
TTL::ONE_MONTH;         // 2592000 seconds

// Zone types
ZoneType::MASTER;       // Master zone
ZoneType::SLAVE;        // Slave zone
ZoneType::PARKED;       // Parked zone
ZoneType::GEODNS;       // GeoDNS zone

// Monitoring types
MonitoringType::DNS;    // DNS monitoring
MonitoringType::TCP;    // TCP port monitoring
MonitoringType::UDP;    // UDP port monitoring
MonitoringType::ICMP;   // Ping monitoring
MonitoringType::SMTP;   // SMTP monitoring
MonitoringType::HTTP;   // HTTP monitoring
MonitoringType::HTTPS;  // HTTPS monitoring
MonitoringType::SSL;    // SSL certificate monitoring

// Pagination options
RowsPerPage::TEN;       // 10 rows
RowsPerPage::TWENTY;    // 20 rows
RowsPerPage::THIRTY;    // 30 rows (default)
RowsPerPage::FIFTY;     // 50 rows
RowsPerPage::HUNDRED;   // 100 rows
```

Error Handling
--------------

[](#error-handling)

The package provides specific exceptions for different error scenarios:

```
use LJPc\ClouDNS\Exceptions\AuthenticationException;
use LJPc\ClouDNS\Exceptions\ValidationException;
use LJPc\ClouDNS\Exceptions\RateLimitException;
use LJPc\ClouDNS\Exceptions\ResourceNotFoundException;
use LJPc\ClouDNS\Exceptions\ClouDNSException;

try {
    $zone = ClouDNS::zones()->create('example.com', ZoneType::MASTER);
} catch (AuthenticationException $e) {
    // Invalid credentials
} catch (ValidationException $e) {
    // Invalid input data
} catch (RateLimitException $e) {
    // API rate limit exceeded
} catch (ResourceNotFoundException $e) {
    // Resource not found
} catch (ClouDNSException $e) {
    // General API error
}
```

Advanced Features
-----------------

[](#advanced-features)

### Caching

[](#caching)

The package includes built-in caching for API responses:

```
// Cache is enabled by default for GET requests
// Configure in .env:
CLOUDNS_CACHE_ENABLED=true
CLOUDNS_CACHE_TTL=3600
```

### Logging

[](#logging)

All API requests and responses can be logged:

```
// Enable logging in .env:
CLOUDNS_LOG_ENABLED=true
CLOUDNS_LOG_CHANNEL=cloudns
```

### Retry Logic

[](#retry-logic)

The package automatically retries failed requests with exponential backoff:

```
// Configure in config/cloudns.php:
'retry' => [
    'max_attempts' => 3,
    'delay' => 1000, // milliseconds
    'multiplier' => 2,
    'max_delay' => 10000,
],
```

### Sub-User Authentication

[](#sub-user-authentication)

Support for ClouDNS sub-user authentication:

```
// Configure in .env:
CLOUDNS_IS_SUB_USER=true
CLOUDNS_SUB_AUTH_ID=123
CLOUDNS_SUB_AUTH_USER=subuser
```

Testing
-------

[](#testing)

The package includes comprehensive PHPUnit tests with 97% code coverage:

```
# Run tests
composer test

# Run tests with coverage
composer test:coverage

# Run specific test suite
composer test -- --testsuite=Unit
composer test -- --testsuite=Integration
```

### Testing Your Integration

[](#testing-your-integration)

```
use LJPc\ClouDNS\Testing\ClouDNSFake;
use LJPc\ClouDNS\Facades\ClouDNS;

// In your test
ClouDNS::fake();

// Configure expected responses
ClouDNS::shouldReceive('zone->list')
    ->once()
    ->andReturn(['example.com', 'example.org']);

// Your code that uses ClouDNS
$zones = ClouDNS::zone()->list();

// Assertions
$this->assertCount(2, $zones);
```

API Rate Limits
---------------

[](#api-rate-limits)

ClouDNS API has the following rate limits:

- 20 requests per second
- 600 requests per minute

The package handles rate limiting automatically with retry logic.

Support
-------

[](#support)

For support, please contact  or visit the [ClouDNS API documentation](https://www.cloudns.net/wiki/article/41/).

###  Health Score

37

—

LowBetter than 82% of packages

Maintenance58

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

305d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd75e522878bb624f5706b3f5ab06867078da7c12567a4f6f5a27d749d5a1164?d=identicon)[Lars-](/maintainers/Lars-)

---

Top Contributors

[![Lars-](https://avatars.githubusercontent.com/u/5690934?v=4)](https://github.com/Lars- "Lars- (4 commits)")

---

Tags

apilaraveldnscloudns

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ljpc-laravel-cloudns/health.svg)

```
[![Health](https://phpackages.com/badges/ljpc-laravel-cloudns/health.svg)](https://phpackages.com/packages/ljpc-laravel-cloudns)
```

###  Alternatives

[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
