Download the PHP package derrickob/hostinger-php-sdk without Composer

On this page you can find all versions of the php package derrickob/hostinger-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package hostinger-php-sdk

Hostinger Datacenter Cover

Latest Version on Packagist Tests Code Style Static Analysis PRs Welcome License

A complete PHP SDK for interacting with the Hostinger API, allowing you to programmatically manage your Hostinger resources including VPS, domains, billing, and more.

Don't Have a Hostinger Account?

Hostinger offers affordable web hosting and VPS solutions with excellent performance, uptime and has an amazing support team. If you don't have a Hostinger account yet, you can sign up using this referral link to get 20% additional discount on top of Hostinger's regular discounts.

Disclaimer: If you use the referral link, I may earn a commission from Hostinger and you'll get 20% discount on your purchase.

Installation

You can install the package via composer:

API Token

To use this SDK, you'll need an API token from Hostinger. You can create one from the Account page of the Hostinger Panel.

Usage

Initialize the Client

Handle Errors

All API errors are converted to exceptions:

Domains

Access domain-related features via $hostinger->domains().

Availability

Access domain availability checks via $hostinger->domains()->availability().

Check Domain Availability

Checks the availability of a domain name across multiple TLDs. Can optionally return alternative suggestions.

Doc: API Reference

Forwarding

Manage domain forwarding via $hostinger->domains()->forwarding().

Get Forwarding Data

Retrieves domain forwarding data.

Doc: API Reference

Delete Forwarding Data

Deletes domain forwarding data.

Doc: API Reference

Create Forwarding Data

Creates domain forwarding data.

Doc: API Reference

Portfolio

Manage your domain portfolio via $hostinger->domains()->portfolio().

Enable Domain Lock

Enables the transfer lock for a domain.

Doc: API Reference

Disable Domain Lock

Disables the transfer lock for a domain.

Doc: API Reference

Get Domain

Retrieves extended details for a specific domain.

Doc: API Reference

Get Domain List

Retrieves a list of all domains associated with your account.

Doc: API Reference

Purchase New Domain

Purchases and registers a new domain name.

Doc: API Reference

Enable Privacy Protection

Enables WHOIS privacy protection for a domain.

Doc: API Reference

Disable Privacy Protection

Disables WHOIS privacy protection for a domain.

Doc: API Reference

Update Nameservers

Updates the nameservers for a domain.

Doc: API Reference

WHOIS

Manage WHOIS contact profiles via $hostinger->domains()->whois().

Get WHOIS Profile List

Retrieves a list of WHOIS contact profiles. Can be filtered by TLD.

Doc: API Reference

Create WHOIS Profile

Creates a new WHOIS contact profile.

Doc: API Reference

Get WHOIS Profile

Retrieves details for a specific WHOIS profile.

Doc: API Reference

Delete WHOIS Profile

Deletes a WHOIS contact profile.

Doc: API Reference

Get WHOIS Profile Usage

Retrieves a list of domains currently using a specific WHOIS profile.

Doc: API Reference

DNS

Access DNS features via $hostinger->dns().

Snapshot

Manage DNS snapshots via $hostinger->dns()->snapshots().

Get Snapshot

Retrieves a specific DNS snapshot with its content.

Doc: API Reference

Restore Snapshot

Restores a domain's DNS zone to the state captured in a selected snapshot.

Doc: API Reference

Get Snapshot List

Retrieves a list of DNS snapshots for a specific domain.

Doc: API Reference

Zone

Manage DNS zones and records via $hostinger->dns()->zones().

Get Records

Retrieves all DNS records for a specific domain.

Doc: API Reference

Update Zone Records

Updates DNS records for the selected domain. Using overwrite = true (default) replaces records; otherwise, appends or updates TTLs.

Doc: API Reference

Delete Zone Records

Deletes specific DNS records based on name and type filters.

Doc: API Reference

Validate Zone Records

Validates DNS records before attempting an update. Throws a ValidationException if invalid.

Doc: API Reference

Reset Zone Records

Resets the DNS zone for a domain to the default Hostinger records.

Doc: API Reference

Billing

Access billing features via $hostinger->billing().

Catalog

Access the service catalog via $hostinger->billing()->catalog().

Get Catalog Item List

Retrieves a list of catalog items available for order. Prices are in cents. Can be filtered.

Doc: API Reference

Orders

Manage service orders via $hostinger->billing()->orders().

Create New Service Order

Creates a new service order. Requires a payment method ID and catalog item price IDs. Orders created via API are set for auto-renewal. Prices are in cents.

Doc: API Reference

Payment Methods

Manage payment methods via $hostinger->billing()->paymentMethods().

Set Default Payment Method

Sets a specific payment method as the default for your account.

Doc: API Reference

Delete Payment Method

Deletes a payment method from your account.

Doc: API Reference

Get Payment Method List

Retrieves available payment methods linked to your account.

Doc: API Reference

Subscriptions

Manage service subscriptions via $hostinger->billing()->subscriptions().

Cancel Subscription

Cancels a subscription and stops further billing.

Doc: API Reference

Get Subscription List

Retrieves all subscriptions associated with your account. Prices are in cents.

Doc: API Reference

VPS

Access Virtual Private Server features via $hostinger->vps().

Actions

View VM action history via $hostinger->vps()->actions().

Get Action

Retrieves details for a specific action performed on a VM.

Doc: API Reference

Get Action List

Retrieves a paginated list of actions performed on a specific VM.

Doc: API Reference

Backups

Manage VM backups via $hostinger->vps()->backups().

Delete Backup

Deletes a specific backup.

Doc: API Reference

Get Backup List

Retrieves a paginated list of backups for a specific virtual machine.

Doc: API Reference

Restore Backup

Restores a VM to the state of a specific backup. Warning: Overwrites current VM data!

Doc: API Reference

Data Centers

Access data center information via $hostinger->vps()->dataCenters().

Get Data Centers List

Retrieves a list of all available Hostinger data centers where VPS can be deployed.

Doc: API Reference

PTR Records

Manage reverse DNS (PTR) records via $hostinger->vps()->ptrRecords().

Create PTR Record

Creates or updates the PTR (reverse DNS) record for a VM's primary IP, pointing to the VM's hostname.

Doc: API Reference

Delete PTR Record

Deletes the PTR record for a VM's primary IP.

Doc: API Reference

Firewall

Manage network firewalls via $hostinger->vps()->firewalls(). Access requires at least one VPS.

Activate Firewall

Activates a firewall for a specific VM. Only one firewall can be active per VM.

Doc: API Reference

Deactivate Firewall

Deactivates the currently active firewall for a specific VM.

Doc: API Reference

Get Firewall

Retrieves details for a specific firewall, including its rules.

Doc: API Reference

Delete Firewall

Deletes a firewall. Any VMs using it will have the firewall deactivated.

Doc: API Reference

Get Firewall List

Retrieves a paginated list of all firewalls available in your account.

Doc: API Reference

Create New Firewall

Creates a new, empty firewall group.

Doc: API Reference

Update Firewall Rule

Updates an existing rule within a firewall. The firewall becomes unsynced if attached to VMs.

Doc: API Reference

Delete Firewall Rule

Deletes a specific rule from a firewall. The firewall becomes unsynced if attached to VMs.

Doc: API Reference

Create Firewall Rule

Adds a new rule to an existing firewall. The firewall becomes unsynced if attached to VMs.

Doc: API Reference

Sync Firewall

Syncs firewall rules to an attached VM if the firewall is marked as unsynced (e.g., after rule changes).

Doc: API Reference

Malware Scanner

Manage the Monarx malware scanner via $hostinger->vps()->malwareScanner().

Get Scan Metrics

Retrieves the latest Monarx malware scan metrics for a VM.

Doc: API Reference

Install Monarx

Installs the Monarx malware scanner on a VM.

Doc: API Reference

Uninstall Monarx

Uninstalls the Monarx malware scanner from a VM.

Doc: API Reference

OS Templates

Access available OS templates via $hostinger->vps()->templates().

Get Template

Retrieves details for a specific OS template.

Doc: API Reference

Get Template List

Retrieves a list of available OS templates for installing on virtual machines.

Doc: API Reference

Post-Install Scripts

Manage scripts to run after OS installation via $hostinger->vps()->postInstallScripts().

Get Post-Install Script

Retrieves details of a specific post-install script.

Doc: API Reference

Update Post-Install Script

Updates the name and/or content of an existing post-install script.

Doc: API Reference

Delete a Post-Install Script

Deletes a post-install script from your account.

Doc: API Reference

Get Post-Install Script List

Retrieves a paginated list of post-install scripts associated with your account.

Doc: API Reference

Create Post-Install Script

Creates a new script that can be run after OS installation on a VM. Max size 48KB.

Doc: API Reference

Public Keys

Manage SSH public keys via $hostinger->vps()->publicKeys().

Attach Public Key

Attaches existing public keys from your account to a specific VM.

Doc: API Reference

Delete a Public Key

Deletes a public key from your account. This does not remove it from VMs it's already attached to.

Doc: API Reference

Get Public Key List

Retrieves a paginated list of SSH public keys associated with your account.

Doc: API Reference

Create New Public Key

Adds a new SSH public key to your account, which can then be attached to VMs.

Doc: API Reference

Recovery

Manage VM recovery mode via $hostinger->vps()->recovery().

Start Recovery Mode

Boots a VM into a temporary recovery environment with the specified root password. The original disk is mounted at /mnt.

Doc: API Reference

Stop Recovery Mode

Boots the VM back into its normal operating system from recovery mode.

Doc: API Reference

Snapshots

Manage VM snapshots via $hostinger->vps()->snapshots(). Note: Only one snapshot is kept per VM.

Get Snapshot

Retrieves information about the current snapshot for a VM.

Doc: API Reference

Create Snapshot

Creates a new snapshot of a VM. Warning: Overwrites any existing snapshot for this VM!

Doc: API Reference

Delete Snapshot

Deletes the existing snapshot for a VM.

Doc: API Reference

Restore Snapshot

Restores a VM to the state of its existing snapshot. Warning: Overwrites current VM data!

Doc: API Reference

Virtual Machine

Manage core VM operations via $hostinger->vps()->virtualMachines().

Get Attached Public Keys

Retrieves a paginated list of SSH public keys attached to a specific virtual machine.

Doc: API Reference

Set Hostname

Sets the hostname for a virtual machine. Does not automatically update PTR record.

Doc: API Reference

Reset Hostname

Resets the hostname and PTR record to the default value (e.g., srvXXXXX.hstgr.cloud).

Doc: API Reference

Get Virtual Machine

Retrieves detailed information for a specific virtual machine.

Doc: API Reference

Get Virtual Machine List

Retrieves a list of all virtual machines in your account.

Doc: API Reference

Purchase New Virtual Machine

Allows you to buy (purchase) and setup a new virtual machine.

If virtual machine setup fails for any reason, login to hPanel and complete the setup manually.

If no payment method is provided, your default payment method will be used automatically.

Doc: API Reference

Get Metrics

Retrieves historical performance metrics (CPU, RAM, Disk, Network, Uptime) for a VM within a specified time range.

Doc: API Reference

Set Nameservers

Sets the DNS resolvers used by the virtual machine.

Doc: API Reference

Set Panel Password

Sets the password for the control panel (if applicable to the OS template). Requires a strong password.

Doc: API Reference

Recreate Virtual Machine

Reinstalls the OS on a virtual machine. Warning: All data will be lost! Snapshots will be deleted. Requires a strong password if provided.

Doc: API Reference

Restart Virtual Machine

Restarts a virtual machine (equivalent to stop then start). Starts a stopped VM.

Doc: API Reference

Set Root Password

Sets the root password for the virtual machine. Requires a strong password.

Doc: API Reference

Setup New Virtual Machine

Sets up a newly purchased VPS (in initial state). Requires OS template and data center.

Doc: API Reference

Start Virtual Machine

Starts a stopped virtual machine.

Doc: API Reference

Stop Virtual Machine

Stops a running virtual machine.

Doc: API Reference

Testing

Run the test suite using Pest:

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details on how to contribute, including coding standards, testing procedures, and guidelines for adding new features.

Credits

License

The MIT License (MIT). Please see the License File for more information.


All versions of hostinger-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.9
ext-json Version *
ext-curl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package derrickob/hostinger-php-sdk contains the following files

Loading the files please wait ....