### Install Openprovider REST Client for PHP using Composer Source: https://github.com/openprovider/rest-client-php/blob/master/README.md This snippet shows the Composer commands required to add the Openprovider REST client library to your PHP project. It includes initializing Composer if necessary, setting the minimum stability, and requiring the specific dev-v1beta version of the package. ```bash composer init composer config minimum-stability dev composer require openprovider/rest-client-php:dev-v1beta ``` -------------------------------- ### Authenticate and Make API Call with Openprovider REST Client (PHP) Source: https://github.com/openprovider/rest-client-php/blob/master/README.md This PHP code demonstrates how to use the Openprovider REST client. It covers including the autoloader, initializing the HTTP client and configuration, authenticating with username and password to get a token, setting the token for subsequent requests, and making a sample API call to retrieve TLD information. ```php getAuthModule()->getAuthApi()->login( new AuthLoginRequest([ 'username' => $username, 'password' => $password, ]) ); // Set token to configuration (it will update the $client). $configuration->setAccessToken($loginResult->getData()->getToken()); // Use this client for API calls. $result = $client->getTldModule()->getTldServiceApi()->getTld('com'); // Operate with the result. print_r($result); ``` -------------------------------- ### Execute Async API Calls with Guzzle Promises Source: https://context7.com/openprovider/rest-client-php/llms.txt Shows how to perform non-blocking API operations using Guzzle promises. Includes examples for batching multiple requests and handling individual responses with callbacks. ```php use GuzzleHttp\Promise\Utils; $promises = [ 'tld_com' => $client->getTldModule()->getTldServiceApi()->getTldAsync('com'), 'tld_net' => $client->getTldModule()->getTldServiceApi()->getTldAsync('net'), 'tld_org' => $client->getTldModule()->getTldServiceApi()->getTldAsync('org'), ]; $results = Utils::unwrap($promises); foreach ($results as $key => $result) { echo "{$key}: .{$result->getData()->getName()} - "; echo "Min period: {$result->getData()->getMinRegistrationPeriod()} years\n"; } $client->getDomainModule()->getDomainServiceApi()->listDomainsAsync() ->then( function ($response) { foreach ($response->getData()->getResults() as $domain) { echo "{$domain->getDomain()->getName()}.{$domain->getDomain()->getExtension()}\n"; } }, function ($exception) { echo "Error: " . $exception->getMessage(); } ) ->wait(); ``` -------------------------------- ### GET /v1/domains/{id} Source: https://context7.com/openprovider/rest-client-php/llms.txt Fetches detailed information about a specific domain, including history and registry statuses. ```APIDOC ## GET /v1/domains/{id} ### Description Retrieve detailed information about a specific domain including history and additional data. ### Method GET ### Endpoint /v1/domains/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The unique domain ID ### Response Example { "id": 12345, "status": "ACT", "creation_date": "2020-01-01", "autorenew": "on" } ``` -------------------------------- ### GET /billing/invoices Source: https://context7.com/openprovider/rest-client-php/llms.txt Retrieve a list of invoices with optional filtering by date and status. ```APIDOC ## GET /billing/invoices ### Description Retrieve invoice history with filtering options. ### Method GET ### Endpoint /billing/invoices ### Query Parameters - **limit** (integer) - Optional - Number of records to return - **from_date** (string) - Optional - Start date (YYYY-MM-DD) - **to_date** (string) - Optional - End date (YYYY-MM-DD) ### Response #### Success Response (200) - **results** (array) - List of invoice objects ``` -------------------------------- ### Get Domain Details Source: https://context7.com/openprovider/rest-client-php/llms.txt Fetches comprehensive details for a specific domain ID, optionally including history and registry statuses. Useful for auditing domain state and metadata. ```php getDomainModule()->getDomainServiceApi()->getDomain( 12345, // Domain ID null, // domain_name null, // domain_extension true, // with_history - include mutation history false, // with_api_history true, // with_additional_data true, // with_verification_email false, // with_abuse_details false, // with_whois_privacy_data true // with_registry_statuses ); $data = $domain->getData(); echo "Domain: {$data->getDomain()->getName()}.{$data->getDomain()->getExtension()}\n"; echo "Status: {$data->getStatus()}\n"; echo "Creation Date: {$data->getCreationDate()}\n"; echo "Renewal Date: {$data->getRenewalDate()}\n"; echo "Autorenew: {$data->getAutorenew()}\n"; ``` -------------------------------- ### GET /v1/domains Source: https://context7.com/openprovider/rest-client-php/llms.txt Retrieves a paginated list of domains with optional filtering by extension, status, or name patterns. ```APIDOC ## GET /v1/domains ### Description Retrieve a list of domains in your account with filtering and pagination options. ### Method GET ### Endpoint /v1/domains ### Query Parameters - **limit** (integer) - Optional - Number of results to return - **offset** (integer) - Optional - Pagination offset - **extension** (string) - Optional - Filter by domain extension - **domain_name_pattern** (string) - Optional - Wildcard search pattern - **status** (string) - Optional - Filter by status (e.g., 'ACT') ### Response Example { "results": [ {"id": 12345, "name": "example.com", "status": "ACT"} ] } ``` -------------------------------- ### Authenticate with Openprovider API Source: https://context7.com/openprovider/rest-client-php/llms.txt Demonstrates how to initialize the client and perform authentication using credentials to obtain an access token. This token must be set in the configuration for all subsequent API requests. ```php getAuthModule()->getAuthApi()->login( new AuthLoginRequest([ 'username' => 'your_username', 'password' => 'your_password', ]) ); $configuration->setAccessToken($loginResult->getData()->getToken()); echo "Token: " . $loginResult->getData()->getToken(); ``` -------------------------------- ### Retrieve TLD Details and List Available TLDs Source: https://context7.com/openprovider/rest-client-php/llms.txt Demonstrates how to fetch specific TLD information including pricing and restrictions, as well as listing all available TLDs with their respective configurations. ```php $tld = $client->getTldModule()->getTldServiceApi()->getTld('com'); echo "TLD: .{$tld->getData()->getName()}\n"; echo "Min registration period: {$tld->getData()->getMinRegistrationPeriod()} years\n"; echo "Max registration period: {$tld->getData()->getMaxRegistrationPeriod()} years\n"; echo "Transfer requires auth code: " . ($tld->getData()->getIsTransferAuthCodeRequired() ? 'Yes' : 'No') . "\n"; echo "IDN supported: " . ($tld->getData()->getIsIdnSupported() ? 'Yes' : 'No') . "\n"; $tlds = $client->getTldModule()->getTldServiceApi()->listTlds( null, // order_by 100, // limit 0, // offset null, // status filter true // with_price ); foreach ($tlds->getData()->getResults() as $tld) { echo ".{$tld->getName()}\n"; if ($tld->getPrices()) { echo " Registration: {$tld->getPrices()->getProduct()->getRegistration()->getValue()}\n"; echo " Renewal: {$tld->getPrices()->getProduct()->getRenewal()->getValue()}\n"; } } ``` -------------------------------- ### Register a New Domain Source: https://context7.com/openprovider/rest-client-php/llms.txt Creates a new domain registration by providing domain details, contact handles, and nameserver configuration. It returns a result object containing the new domain ID. ```php getDomainModule()->getDomainServiceApi()->createDomain( new DomainCreateDomainRequest([ 'domain' => [ 'name' => 'mynewdomain', 'extension' => 'com' ], 'period' => 1, // Registration period in years 'owner_handle' => 'SR003456-XX', // Contact handle for domain owner 'admin_handle' => 'SR003456-XX', 'tech_handle' => 'SR003456-XX', 'billing_handle' => 'SR003456-XX', 'ns_group' => 'dns-openprovider', // Nameserver group 'autorenew' => 'on', ]) ); echo "Domain ID: " . $createResult->getData()->getId(); ``` -------------------------------- ### List SSL Products using PHP Source: https://context7.com/openprovider/rest-client-php/llms.txt Retrieves a list of available SSL certificate products from the OpenProvider system. This function allows filtering by brand and validation method (DV, OV, EV), and supports pagination. It iterates through the products and displays their names, brands, validation methods, and maximum domain support. ```php getSslModule()->getProductApi()->listProducts( null, // order_by 50, // limit 0, // offset null, // brand filter 'dv' // validation type: dv, ov, ev ); foreach ($products->getData()->getResults() as $product) { echo "{$product->getName()}\n"; echo " Brand: {$product->getBrand()}\n"; echo " Validation: {$product->getValidationMethod()}\n"; echo " Max domains: {$product->getMaxDomains()}\n"; } ?> ``` -------------------------------- ### Create SSL Order - PHP Source: https://context7.com/openprovider/rest-client-php/llms.txt Orders a new SSL certificate by providing product details, CSR, and validation information. Requires product ID, period, CSR, software ID, and contact handles. ```php getSslModule()->getOrderApi()->createOrder( new OrderCreateOrderRequest([ 'product_id' => 1234, // SSL product ID 'period' => 1, // Years 'csr' => '-----BEGIN CERTIFICATE REQUEST----- MIICvjCCAaYCAQAweTELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQH ... -----END CERTIFICATE REQUEST----- ', 'software_id' => 'nginx', 'organization_handle' => 'SR003456-XX', 'technical_handle' => 'SR003456-XX', 'approver_email' => 'admin@example.com', 'domain_amount' => 1, 'hosting_type' => 'saas' ]) ); echo "SSL Order ID: " . $orderResult->getData()->getId(); ?> ``` -------------------------------- ### List SSL Products Source: https://context7.com/openprovider/rest-client-php/llms.txt Retrieve a list of available SSL certificate products, including their specifications and validation methods. ```APIDOC ## List SSL Products ### Description Get available SSL certificate products and their specifications. ### Method GET (Implied by the client method) ### Endpoint /ssl/products (Implied) ### Parameters #### Query Parameters - **order_by** (string) - Optional - Field to order the results by. - **limit** (integer) - Optional - Maximum number of results to return. - **offset** (integer) - Optional - Number of results to skip. - **brand** (string) - Optional - Filter products by brand. - **validation_type** (string) - Optional - Filter products by validation type ('dv', 'ov', 'ev'). ### Request Example ```php $products = $client->getSslModule()->getProductApi()->listProducts( null, // order_by 50, // limit 0, // offset null, // brand filter 'dv' // validation type: dv, ov, ev ); ``` ### Response #### Success Response (200) - **data** (object) - **results** (array) - An array of SSL product objects. - **name** (string) - The name of the SSL product. - **brand** (string) - The brand of the SSL product. - **validation_method** (string) - The validation method (e.g., 'dv', 'ov', 'ev'). - **max_domains** (integer) - The maximum number of domains supported by the product. #### Response Example ```json { "data": { "results": [ { "name": "PositiveSSL", "brand": "Sectigo", "validation_method": "dv", "max_domains": 1 } ] } } ``` ``` -------------------------------- ### Create DNS Zone using PHP Source: https://context7.com/openprovider/rest-client-php/llms.txt Creates a new DNS zone for a given domain name, including initial DNS records. This function requires the domain name, zone type, and a list of records to be configured. It returns a success status upon completion. ```php getDnsModule()->getZoneServiceApi()->createZone( new ZoneCreateZoneRequest([ 'name' => 'example.com', 'type' => 'master', 'records' => [ new ZoneRecord([ 'type' => 'A', 'name' => '@', 'value' => '192.168.1.1', 'ttl' => 3600 ]), new ZoneRecord([ 'type' => 'A', 'name' => 'www', 'value' => '192.168.1.1', 'ttl' => 3600 ]), new ZoneRecord([ 'type' => 'MX', 'name' => '@', 'value' => 'mail.example.com', 'ttl' => 3600, 'prio' => 10 ]), new ZoneRecord([ 'type' => 'TXT', 'name' => '@', 'value' => 'v=spf1 include:_spf.google.com ~all', 'ttl' => 3600 ]) ] ]) ); echo $zoneResult->getData()->getSuccess() ? "Zone created" : "Creation failed"; ?> ``` -------------------------------- ### Create Nameserver Group Source: https://context7.com/openprovider/rest-client-php/llms.txt Create a new group of nameservers that can be easily assigned to multiple domains. ```APIDOC ## Create Nameserver Group ### Description Group nameservers for easy assignment to multiple domains. ### Method POST (Implied by the client method) ### Endpoint /dns/nsgroups (Implied) ### Parameters #### Request Body - **name** (string) - Required - The name of the nameserver group. - **ns_group** (object) - Required - An object containing the nameserver details. - **ns1** (string) - Required - The first nameserver. - **ns2** (string) - Required - The second nameserver. - **ns3** (string) - Optional - The third nameserver. - **ns4** (string) - Optional - The fourth nameserver. ### Request Example ```php use Openprovider\Api\Rest\Client\Dns\Model\NsGroupCreateGroupRequest; use Openprovider\Api\Rest\Client\Dns\Model\NsGroupNameServersSet; $nsGroupResult = $client->getDnsModule()->getNsGroupServiceApi()->createGroup( new NsGroupCreateGroupRequest([ 'name' => 'my-ns-group', 'ns_group' => new NsGroupNameServersSet([ 'ns1' => 'ns1.example.com', 'ns2' => 'ns2.example.com', 'ns3' => 'ns3.example.com', 'ns4' => 'ns4.example.com' ]) ]) ); ``` ### Response #### Success Response (200) - **data** (object) - **id** (integer) - The ID of the created nameserver group. #### Response Example ```json { "data": { "id": 12345 } } ``` ``` -------------------------------- ### Check Domain Availability Source: https://context7.com/openprovider/rest-client-php/llms.txt Uses the DomainServiceApi to query the registration status of multiple domains simultaneously. It returns a list of results indicating whether each domain is free or active. ```php getDomainModule()->getDomainServiceApi()->checkDomain( new DomainCheckDomainRequest([ 'domains' => [ ['name' => 'example', 'extension' => 'com'], ['name' => 'example', 'extension' => 'net'], ['name' => 'example', 'extension' => 'org'], ] ]) ); foreach ($checkResult->getData()->getResults() as $domain) { $status = $domain->getStatus(); echo "{$domain->getDomain()}: {$status}\n"; } ``` -------------------------------- ### POST /v1/domains Source: https://context7.com/openprovider/rest-client-php/llms.txt Registers a new domain with specified owner contacts and nameserver configurations. ```APIDOC ## POST /v1/domains ### Description Creates a new domain registration with owner contact information and nameservers. ### Method POST ### Endpoint /v1/domains ### Request Body - **domain** (object) - Required - Domain name and extension - **period** (integer) - Required - Registration period in years - **owner_handle** (string) - Required - Contact handle for domain owner - **ns_group** (string) - Optional - Nameserver group name - **autorenew** (string) - Optional - Autorenew status ('on' or 'off') ### Request Example { "domain": {"name": "mynewdomain", "extension": "com"}, "period": 1, "owner_handle": "SR003456-XX", "ns_group": "dns-openprovider", "autorenew": "on" } ``` -------------------------------- ### List DNS Zones using PHP Source: https://context7.com/openprovider/rest-client-php/llms.txt Retrieves a list of all DNS zones associated with the account. Supports filtering by name, type, and inclusion of records, as well as pagination with limit and offset. It iterates through the results and prints basic zone information. ```php getDnsModule()->getZoneServiceApi()->listZones( null, // order_by 100, // limit 0, // offset null, // name filter 'master', // type filter null // with_records ); foreach ($zones->getData()->getResults() as $zone) { echo "Zone: {$zone->getName()}\n"; echo " Type: {$zone->getType()}\n"; echo " Records: " . count($zone->getRecords()) . "\n"; } ?> ``` -------------------------------- ### POST /ssl/orders Source: https://context7.com/openprovider/rest-client-php/llms.txt Create a new SSL certificate order by providing CSR and validation details. ```APIDOC ## POST /ssl/orders ### Description Order a new SSL certificate with CSR and validation details. ### Method POST ### Endpoint /ssl/orders ### Request Body - **product_id** (integer) - Required - SSL product ID - **period** (integer) - Required - Years of validity - **csr** (string) - Required - Certificate Signing Request content - **software_id** (string) - Required - Server software identifier - **organization_handle** (string) - Required - Organization handle - **technical_handle** (string) - Required - Technical contact handle - **approver_email** (string) - Required - Email for validation ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the created SSL order ``` -------------------------------- ### POST /contacts Source: https://context7.com/openprovider/rest-client-php/llms.txt Create a new contact record for domain registrations. ```APIDOC ## POST /contacts ### Description Create a new contact record for domain registrations. ### Method POST ### Endpoint /contacts ### Request Body - **name** (object) - Required - First and last name - **address** (object) - Required - Physical address details - **email** (string) - Required - Contact email address ### Response #### Success Response (200) - **handle** (string) - The unique contact handle ``` -------------------------------- ### Create Nameserver Group using PHP Source: https://context7.com/openprovider/rest-client-php/llms.txt Creates a new nameserver group, which can be used to assign a set of nameservers to multiple domains. This function requires a group name and the specific nameservers (ns1 to ns4) to be included in the group. It returns the ID of the newly created group. ```php getDnsModule()->getNsGroupServiceApi()->createGroup( new NsGroupCreateGroupRequest([ 'name' => 'my-ns-group', 'ns_group' => new NsGroupNameServersSet([ 'ns1' => 'ns1.example.com', 'ns2' => 'ns2.example.com', 'ns3' => 'ns3.example.com', 'ns4' => 'ns4.example.com' ]) ]) ); echo "NS Group ID: " . $nsGroupResult->getData()->getId(); ?> ``` -------------------------------- ### List Contacts via Openprovider PHP Client Source: https://context7.com/openprovider/rest-client-php/llms.txt Retrieves a list of contacts from the account using the PersonModule. It supports filtering by last name and pagination parameters. ```php $contacts = $client->getPersonModule()->getContactServiceApi()->listContacts( null, // order_by 100, // limit 0, // offset null, // email filter null, // handle filter 'Doe' // last_name pattern ); foreach ($contacts->getData()->getResults() as $contact) { echo "{$contact->getHandle()}: "; echo "{$contact->getName()->getFirstName()} {$contact->getName()->getLastName()}\n"; echo " Email: {$contact->getEmail()}\n"; echo " Company: {$contact->getCompanyName()}\n"; } ``` -------------------------------- ### Create Contact - PHP Source: https://context7.com/openprovider/rest-client-php/llms.txt Creates a new contact record with detailed personal and address information. This is used for domain registrations and other services requiring contact details. ```php getPersonModule()->getContactServiceApi()->createContact( new ContactCreateContactRequest([ 'name' => new ContactName([ 'first_name' => 'John', 'last_name' => 'Doe', 'prefix' => 'Mr' ]), 'company_name' => 'Example Inc', 'address' => new ContactAddress([ 'street' => '123 Main Street', 'number' => '456', 'city' => 'San Francisco', 'state' => 'California', 'zipcode' => '94102', 'country' => 'US' ]), 'phone' => new ContactPhone([ 'country_code' => '+1', 'area_code' => '415', 'subscriber_number' => '5551234' ]), 'email' => 'john.doe@example.com' ]) ); echo "Contact Handle: " . $contactResult->getData()->getHandle(); ?> ``` -------------------------------- ### List Domains with Filters Source: https://context7.com/openprovider/rest-client-php/llms.txt Retrieves a paginated list of domains based on specific filters like extension, name pattern, and status. It iterates through the results to display domain information. ```php getDomainModule()->getDomainServiceApi()->listDomains( null, null, null, null, null, null, null, null, null, // Order by parameters 100, // limit 0, // offset null, // id 'com', // extension filter null, // renewal_date null, // full_name 'example*', // domain_name_pattern (wildcard search) null, // ns_group_pattern 'ACT' // status filter (ACT = active) ); foreach ($domains->getData()->getResults() as $domain) { echo "{$domain->getId()}: {$domain->getDomain()->getName()}.{$domain->getDomain()->getExtension()}\n"; echo " Expiration: {$domain->getExpirationDate()}\n"; echo " Status: {$domain->getStatus()}\n"; } ``` -------------------------------- ### Create DNS Zone Source: https://context7.com/openprovider/rest-client-php/llms.txt This endpoint allows you to create a new DNS zone for a given domain name. You can specify various DNS records to be included in the zone upon creation. ```APIDOC ## Create DNS Zone ### Description Create a new DNS zone for domain name resolution. ### Method POST (Implied by the client method) ### Endpoint /dns/zones (Implied) ### Parameters #### Request Body - **name** (string) - Required - The name of the domain for which to create the DNS zone. - **type** (string) - Required - The type of the zone (e.g., 'master'). - **records** (array) - Optional - An array of DNS records to be created within the zone. - **type** (string) - Required - The type of the DNS record (e.g., 'A', 'MX', 'TXT', 'CNAME'). - **name** (string) - Required - The name of the DNS record (e.g., '@' for the root domain). - **value** (string) - Required - The value of the DNS record. - **ttl** (integer) - Optional - The Time To Live for the record in seconds. - **prio** (integer) - Optional - The priority for MX records. ### Request Example ```php use Openprovider\Api\Rest\Client\Dns\Model\ZoneCreateZoneRequest; use Openprovider\Api\Rest\Client\Dns\Model\ZoneRecord; $zoneResult = $client->getDnsModule()->getZoneServiceApi()->createZone( new ZoneCreateZoneRequest([ 'name' => 'example.com', 'type' => 'master', 'records' => [ new ZoneRecord([ 'type' => 'A', 'name' => '@', 'value' => '192.168.1.1', 'ttl' => 3600 ]) ] ]) ); ``` ### Response #### Success Response (200) - **data** (object) - Contains the result of the zone creation. - **success** (boolean) - Indicates if the zone creation was successful. #### Response Example ```json { "data": { "success": true } } ``` ``` -------------------------------- ### POST /v1/domains/transfer Source: https://context7.com/openprovider/rest-client-php/llms.txt Initiates a domain transfer from another registrar using an authorization code. ```APIDOC ## POST /v1/domains/transfer ### Description Initiate a domain transfer from another registrar. ### Method POST ### Endpoint /v1/domains/transfer ### Request Body - **domain** (object) - Required - Domain name and extension - **auth_code** (string) - Required - EPP authorization code - **period** (integer) - Required - Years to extend upon transfer ``` -------------------------------- ### PUT /v1/domains/{id} Source: https://context7.com/openprovider/rest-client-php/llms.txt Updates domain settings such as nameservers, autorenewal status, and contact handles. ```APIDOC ## PUT /v1/domains/{id} ### Description Modify domain settings such as nameservers, autorenew status, and contact handles. ### Method PUT ### Endpoint /v1/domains/{id} ### Request Body - **autorenew** (string) - Optional - Set to 'on' or 'off' - **ns_group** (string) - Optional - Nameserver group identifier - **is_locked** (boolean) - Optional - Enable or disable transfer lock ``` -------------------------------- ### POST /v1/domains/{id}/renew Source: https://context7.com/openprovider/rest-client-php/llms.txt Extends the registration period of an existing domain. ```APIDOC ## POST /v1/domains/{id}/renew ### Description Extend domain registration for additional years. ### Method POST ### Endpoint /v1/domains/{id}/renew ### Request Body - **period** (integer) - Required - Number of years to extend ``` -------------------------------- ### POST /ssl/csr Source: https://context7.com/openprovider/rest-client-php/llms.txt Generate a new Certificate Signing Request (CSR) and private key. ```APIDOC ## POST /ssl/csr ### Description Create a Certificate Signing Request using the API. ### Method POST ### Endpoint /ssl/csr ### Request Body - **common_name** (string) - Required - Domain name - **organization** (string) - Required - Organization name - **key_size** (integer) - Required - Key size (e.g., 2048) ### Response #### Success Response (200) - **csr** (string) - The generated CSR - **key** (string) - The generated private key ``` -------------------------------- ### Transfer Domain Source: https://context7.com/openprovider/rest-client-php/llms.txt Initiates a domain transfer from another registrar to Openprovider. Requires an authorization code and contact handles. ```php getDomainModule()->getDomainServiceApi()->transferDomain( new DomainTransferDomainRequest([ 'domain' => [ 'name' => 'domaintotransfer', 'extension' => 'com' ], 'auth_code' => 'EPP-AUTH-CODE-FROM-CURRENT-REGISTRAR', 'owner_handle' => 'SR003456-XX', 'admin_handle' => 'SR003456-XX', 'tech_handle' => 'SR003456-XX', 'billing_handle' => 'SR003456-XX', 'ns_group' => 'dns-openprovider', 'period' => 1, // Additional years ]) ); echo "Transfer initiated. Domain ID: " . $transferResult->getData()->getId(); ``` -------------------------------- ### List DNS Zones Source: https://context7.com/openprovider/rest-client-php/llms.txt Retrieve a list of all DNS zones associated with your account, with options for filtering and pagination. ```APIDOC ## List DNS Zones ### Description Retrieve all DNS zones in your account. ### Method GET (Implied by the client method) ### Endpoint /dns/zones (Implied) ### Parameters #### Query Parameters - **order_by** (string) - Optional - Field to order the results by. - **limit** (integer) - Optional - Maximum number of results to return. - **offset** (integer) - Optional - Number of results to skip. - **name** (string) - Optional - Filter zones by name. - **type** (string) - Optional - Filter zones by type (e.g., 'master'). - **with_records** (boolean) - Optional - Whether to include records in the response. ### Request Example ```php $zones = $client->getDnsModule()->getZoneServiceApi()->listZones( null, // order_by 100, // limit 0, // offset null, // name filter 'master', // type filter null // with_records ); ``` ### Response #### Success Response (200) - **data** (object) - **results** (array) - An array of DNS zone objects. - **name** (string) - The name of the DNS zone. - **type** (string) - The type of the DNS zone. - **records** (array) - An array of DNS records within the zone. #### Response Example ```json { "data": { "results": [ { "name": "example.com", "type": "master", "records": [ { "type": "A", "name": "@", "value": "192.168.1.1", "ttl": 3600 } ] } ] } } ``` ``` -------------------------------- ### List Transactions - PHP Source: https://context7.com/openprovider/rest-client-php/llms.txt Fetches account transaction history with support for sorting, limiting, and filtering by transaction type and date range. Provides an overview of financial activities. ```php getBillingModule()->getTransactionApi()->listTransactions( null, // order_by 100, // limit 0, // offset null, // type filter '2024-01-01', // from date '2024-12-31' // to date ); foreach ($transactions->getData()->getResults() as $transaction) { echo "{$transaction->getCreationDate()}: "; echo "{$transaction->getType()} - "; echo "{$transaction->getPrice()->getValue()} {$transaction->getPrice()->getCurrency()}\n"; echo " Description: {$transaction->getSubject()}\n"; } ?> ``` -------------------------------- ### List Invoices - PHP Source: https://context7.com/openprovider/rest-client-php/llms.txt Retrieves a list of invoices with options for sorting, limiting results, and filtering by date range. Useful for tracking billing history. ```php getBillingModule()->getInvoiceServiceApi()->listInvoices( null, // order_by 50, // limit 0, // offset null, // status filter '2024-01-01', // from date '2024-12-31' // to date ); foreach ($invoices->getData()->getResults() as $invoice) { echo "Invoice #{$invoice->getId()}\n"; echo " Date: {$invoice->getCreationDate()}\n"; echo " Total: {$invoice->getTotalPrice()->getValue()} {$invoice->getTotalPrice()->getCurrency()}\n"; echo " Status: {$invoice->getStatus()}\n"; } ?> ``` -------------------------------- ### Manage DNS Records using PHP Source: https://context7.com/openprovider/rest-client-php/llms.txt Updates DNS records within an existing zone by adding, removing, or modifying them. This function allows for batch operations on records, specifying original record details for updates. It requires the zone name and a set of record changes. ```php getDnsModule()->getZoneServiceApi()->updateZone( 'example.com', new ZoneUpdateZoneRequest([ 'records' => new ZoneRecordUpdates([ 'add' => [ new ZoneRecord([ 'type' => 'CNAME', 'name' => 'blog', 'value' => 'blog.provider.com', 'ttl' => 3600 ]) ], 'remove' => [ new ZoneRecord([ 'type' => 'A', 'name' => 'old-subdomain', 'value' => '192.168.1.100' ]) ], 'update' => [ new ZoneRecordWithOriginal([ 'original' => new ZoneRecord([ 'type' => 'A', 'name' => 'www', 'value' => '192.168.1.1' ]), 'record' => new ZoneRecord([ 'type' => 'A', 'name' => 'www', 'value' => '192.168.1.2', 'ttl' => 7200 ]) ]) ] ]) ]) ); ?> ``` -------------------------------- ### Handle API Token Expiration Source: https://context7.com/openprovider/rest-client-php/llms.txt Implements a wrapper pattern to catch authentication exceptions and automatically re-authenticate when a token expires. It checks for specific error codes to trigger the refresh logic. ```php getResponseBody(), true); if (!$response || $response['code'] !== 196) { throw $e; } $loginResult = $client->getAuthModule()->getAuthApi()->login( new AuthLoginRequest(['username' => $username, 'password' => $password]) ); $configuration->setAccessToken($loginResult->getData()->getToken()); return $callback(); } }; $tryApi(function () use ($client) { $result = $client->getTldModule()->getTldServiceApi()->getTld('com'); print_r($result); }); ``` -------------------------------- ### Manage DNS Records Source: https://context7.com/openprovider/rest-client-php/llms.txt Update existing DNS records within a zone by adding, removing, or modifying them. ```APIDOC ## Manage DNS Records ### Description Add, update, or remove DNS records within a zone. ### Method PUT (Implied by the client method) ### Endpoint /dns/zones/{zone_name} (Implied) ### Parameters #### Path Parameters - **zone_name** (string) - Required - The name of the DNS zone to update. #### Request Body - **records** (object) - An object containing arrays for adding, removing, and updating records. - **add** (array) - Optional - An array of new ZoneRecord objects to add. - **remove** (array) - Optional - An array of ZoneRecord objects to remove. - **update** (array) - Optional - An array of ZoneRecordWithOriginal objects to update. - **original** (object) - The original record details. - **type** (string) - Required - The type of the DNS record. - **name** (string) - Required - The name of the DNS record. - **value** (string) - Required - The value of the DNS record. - **record** (object) - The updated record details. - **type** (string) - Required - The type of the DNS record. - **name** (string) - Required - The name of the DNS record. - **value** (string) - Required - The value of the DNS record. - **ttl** (integer) - Optional - The Time To Live for the record in seconds. ### Request Example ```php use Openprovider\Api\Rest\Client\Dns\Model\ZoneUpdateZoneRequest; use Openprovider\Api\Rest\Client\Dns\Model\ZoneRecordUpdates; use Openprovider\Api\Rest\Client\Dns\Model\ZoneRecord; use Openprovider\Api\Rest\Client\Dns\Model\ZoneRecordWithOriginal; $updateResult = $client->getDnsModule()->getZoneServiceApi()->updateZone( 'example.com', new ZoneUpdateZoneRequest([ 'records' => new ZoneRecordUpdates([ 'add' => [ new ZoneRecord([ 'type' => 'CNAME', 'name' => 'blog', 'value' => 'blog.provider.com', 'ttl' => 3600 ]) ], 'remove' => [ new ZoneRecord([ 'type' => 'A', 'name' => 'old-subdomain', 'value' => '192.168.1.100' ]) ], 'update' => [ new ZoneRecordWithOriginal([ 'original' => new ZoneRecord([ 'type' => 'A', 'name' => 'www', 'value' => '192.168.1.1' ]), 'record' => new ZoneRecord([ 'type' => 'A', 'name' => 'www', 'value' => '192.168.1.2', 'ttl' => 7200 ]) ]) ] ]) ]) ); ``` ### Response (Response details not provided in the source text, typically indicates success or failure of the update operation.) ``` -------------------------------- ### List Payments - PHP Source: https://context7.com/openprovider/rest-client-php/llms.txt Retrieves a history of payments made to the account, allowing for sorting and limiting the number of results. Essential for tracking payment records. ```php getBillingModule()->getPaymentApi()->listPayments( null, // order_by 50, // limit 0 // offset ); foreach ($payments->getData()->getResults() as $payment) { echo "Payment {$payment->getId()}\n"; echo " Amount: {$payment->getPrice()->getValue()} {$payment->getPrice()->getCurrency()}\n"; echo " Date: {$payment->getCreationDate()}\n"; echo " Status: {$payment->getStatus()}\n"; } ?> ``` -------------------------------- ### DELETE /v1/domains/{id} Source: https://context7.com/openprovider/rest-client-php/llms.txt Removes a domain from the account. ```APIDOC ## DELETE /v1/domains/{id} ### Description Remove a domain from your account. ### Method DELETE ### Endpoint /v1/domains/{id} ### Query Parameters - **type** (string) - Optional - 'default' or 'immediate' - **force_delete** (boolean) - Optional - Force deletion even with glue records ``` -------------------------------- ### Generate CSR - PHP Source: https://context7.com/openprovider/rest-client-php/llms.txt Generates a Certificate Signing Request (CSR) and its corresponding private key using API parameters. Requires common name, organization details, and key size. ```php getSslModule()->getCsrApi()->createCsr( new CsrCreateCsrRequest([ 'common_name' => 'www.example.com', 'organization' => 'Example Inc', 'organizational_unit' => 'IT Department', 'locality' => 'San Francisco', 'state' => 'California', 'country' => 'US', 'email' => 'admin@example.com', 'key_size' => 2048 ]) ); echo "CSR:\n" . $csrResult->getData()->getCsr(); echo "\nPrivate Key:\n" . $csrResult->getData()->getKey(); ?> ``` -------------------------------- ### Update Domain Settings Source: https://context7.com/openprovider/rest-client-php/llms.txt Updates specific domain attributes such as nameserver groups, autorenewal status, and transfer locks. Requires the domain ID and a request object. ```php getDomainModule()->getDomainServiceApi()->updateDomain( 12345, // Domain ID new DomainUpdateDomainRequest([ 'autorenew' => 'on', 'ns_group' => 'my-nameserver-group', 'owner_handle' => 'SR003456-XX', 'is_locked' => true, // Enable transfer lock ]) ); echo $updateResult->getData()->getSuccess() ? "Updated successfully" : "Update failed"; ``` -------------------------------- ### Delete Domain Source: https://context7.com/openprovider/rest-client-php/llms.txt Removes a domain from the account. Supports different deletion types and force options for handling glue records. ```php getDomainModule()->getDomainServiceApi()->deleteDomain( 12345, // Domain ID null, // domain_name null, // domain_extension 'default', // type: 'default' or 'immediate' false, // skip_soft_quarantine false // force_delete (even with glue records) ); echo $deleteResult->getData()->getSuccess() ? "Domain deleted" : "Delete failed"; ``` -------------------------------- ### Renew Domain Source: https://context7.com/openprovider/rest-client-php/llms.txt Extends the registration period of an existing domain by a specified number of years. Returns the updated renewal date. ```php getDomainModule()->getDomainServiceApi()->renewDomain( 12345, // Domain ID new DomainRenewDomainRequest([ 'period' => 1 // Years to extend ]) ); echo "Domain renewed. New expiration: " . $renewResult->getData()->getRenewalDate(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.