PHP code example of josephjoberno / namecheap-laravel-sdk

1. Go to this page and download the library: Download josephjoberno/namecheap-laravel-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

josephjoberno / namecheap-laravel-sdk example snippets


'providers' => [
    // ...
    Namecheap\Laravel\NamecheapServiceProvider::class,
];

'aliases' => [
    // ...
    'Namecheap' => Namecheap\Laravel\Facades\Namecheap::class,
];

use Namecheap\Laravel\Facades\Namecheap;

// Example usage
$response = Namecheap::domains()->getList();

use Namecheap\Laravel\Facades\Namecheap;

// Get list of domains
$domains = Namecheap::domains()->getList();

// Check domain availability
$available = Namecheap::domains()->check('example.com');

// Register a domain
$result = Namecheap::domains()->create([
    'DomainName' => 'example.com',
    'Years' => 1
]);

use Namecheap\Laravel\Facades\Namecheap;

// Get DNS records for a domain
$records = Namecheap::dns()->getList('example.com');

// Set DNS hosts for a domain
$result = Namecheap::dns()->setHosts('example.com', [
    [
        'HostName' => '@',
        'RecordType' => 'A',
        'Address' => '192.0.2.1',
        'TTL' => '1800'
    ]
]);

use Namecheap\Laravel\Facades\Namecheap;

// Get list of SSL certificates
$certificates = Namecheap::ssl()->getList();

// Purchase a new SSL certificate
$result = Namecheap::ssl()->create([
    'Type' => 'PositiveSSL',
    'Years' => 1
]);

use Namecheap\Laravel\Facades\Namecheap;

// Get user address information
$address = Namecheap::users()->getAddress();

// Get pricing information
$pricing = Namecheap::users()->getPricing();

use Namecheap\Laravel\Facades\Namecheap;

// Get WHOIS information for a domain
$whois = Namecheap::whois()->getInfo('example.com');

// Update WHOIS information
$result = Namecheap::whois()->update('example.com', [
    'FirstName' => 'John',
    'LastName' => 'Doe',
    'EmailAddress' => '[email protected]'
]);