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

Availability

Check Domain Availability

Checks the availability of a domain name across multiple TLDs.

Portfolio

Get Domain List

Retrieves a list of all domains associated with your account.

DNS

Snapshot

Get Snapshot

Retrieves a specific DNS snapshot

Restore Snapshot

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

Get Snapshot List

Retrieves a list of DNS snapshots for a specific domain.

Zone

Get Records

Retrieves all DNS records for a specific domain.

Update Zone Records

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

Delete Zone Records

Deletes specific DNS records based on name and type filters.

Validate Zone Records

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

Reset Zone Records

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

Billing

Catalog

Get Catalog Item List

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

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

Payment Methods

Set Default Payment Method

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

Delete Payment Method

Deletes a payment method from your account.

Get Payment Method List

Retrieves available payment methods linked to your account.

Subscriptions

Cancel Subscription

Cancels a subscription and stops further billing.

Get Subscription List

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

VPS

Actions

Get Action

Retrieves details for a specific action performed on a VM.

Get Action List

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

Backups

Delete Backup

Deletes a specific backup.

Get Backup List

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

Restore Backup

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

Data Centers

Get Data Centers List

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

PTR Records

Create PTR Record

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

Delete PTR Record

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

Firewall

Activate Firewall

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

Deactivate Firewall

Deactivates the currently active firewall for a specific VM.

Get Firewall

Retrieves details for a specific firewall, including its rules.

Delete Firewall

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

Get Firewall List

Retrieves a paginated list of all firewalls available in your account. Access requires having at least one VPS.

Create New Firewall

Creates a new, empty firewall group.

Update Firewall Rule

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

Delete Firewall Rule

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

Create Firewall Rule

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

Sync Firewall

Syncs firewall rules to an attached VM if the firewall is marked as unsynced.

Malware Scanner

Get Scan Metrics

Retrieves the latest Monarx malware scan metrics for a VM.

Install Monarx

Installs the Monarx malware scanner on a VM.

Uninstall Monarx

Uninstalls the Monarx malware scanner from a VM.

OS Templates

Get Template

Retrieves details for a specific OS template.

Get Template List

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

Post-Install Scripts

Get Post-Install Script

Retrieves details of a specific post-install script.

Update Post-Install Script

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

Delete a Post-Install Script

Deletes a post-install script from your account.

Get Post-Install Script List

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

Create Post-Install Script

Creates a new script that can be run after OS installation on a VM.

Public Keys

Attach Public Key

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

Delete a Public Key

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

Get Public Key List

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

Create New Public Key

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

Recovery

Start Recovery Mode

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

Stop Recovery Mode

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

Snapshots

Get Snapshot

Retrieves information about the current snapshot for a VM (only one snapshot is kept per VM).

Create Snapshot

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

Delete Snapshot

Deletes the existing snapshot for a VM.

Restore Snapshot

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

Virtual Machine

Get Attached Public Keys

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

Set Hostname

Sets the hostname for a virtual machine.

Reset Hostname

Resets the hostname and PTR record to the default value.

Get Virtual Machine

Retrieves detailed information for a specific virtual machine.

Get Virtual Machine List

Retrieves a list of all virtual machines in your account.

Get Metrics

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

Set Nameservers

Sets the DNS resolvers used by the virtual machine.

Set Panel Password

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

Recreate Virtual Machine

Reinstalls the OS on a virtual machine. All data will be lost!

Restart Virtual Machine

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

Set Root Password

Sets the root password for the virtual machine.

Setup New Virtual Machine

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

Start Virtual Machine

Starts a stopped virtual machine.

Stop Virtual Machine

Stops a running virtual machine.

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 ....