carmelosantana/porkbun-sdk

A PHP library for interacting with the Porkbun API.

1.0.0 2024-08-29 16:19 UTC

This package is auto-updated.

Last update: 2024-08-29 16:38:06 UTC


README

PHP library for interacting with the Porkbun API.

Supports

Interactions with Porkbun's API for;

  • Domain management
  • DNS record management
  • SSL certificate retrieval

Features

  • Manage domains: Update name servers, list domains, and more.
  • Handle DNS records: Create, edit, retrieve, and delete DNS records.
  • Manage SSL certificates: Retrieve SSL certificate bundles for your domains.

Install

Include PorkbunSdk in your project with Composer:

composer require carmelosantana/porkbun-sdk

Requirements:

Usage

To use the Porkbun API, you need to have an API key and secret from Porkbun. You can obtain these by logging into your Porkbun account and generating an API key.

Domain

✅ Update the name servers for a domain.

$domain = new PorkbunSdk\Domain('your_api_key', 'your_secret_api_key');

$response = $domain->updateNameServers('example.com', [
    'ns1.example.com',
    'ns2.example.com'
]);

print_r($response);

DNS

✅ Create a new DNS A record for a domain.

$dns = new PorkbunSdk\DNS('your_api_key', 'your_secret_api_key');

$response = $dns->createRecord('example.com', 'A', '1.1.1.1', 'www');

print_r($response);

SSL

✅ Retrieve the SSL certificate bundle for a domain.

$ssl = new PorkbunSdk\SSL('your_api_key', 'your_secret_api_key');

$response = $ssl->getCertificate('example.com');

print_r($response);

Testing

To run the test suite:

composer test

Requirements:

  • Pest is used for testing.

Support

Community support is available on Discord.

Funding

If you find this project useful or use it in a commercial environment, please consider donating:

Changelog

  • 1.0.0 - Aug 29, 2024
    • Initial release of the PorkbunSdk library with support for Domain, DNS, and SSL management.

License

Code and documentation are released under the MIT License.