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.
Download derrickob/hostinger-php-sdk
More information about derrickob/hostinger-php-sdk
Files in derrickob/hostinger-php-sdk
Package hostinger-php-sdk
Short Description A PHP SDK for interacting with the Hostinger API
License MIT
Homepage https://github.com/derrickobedgiu1/hostinger-php-sdk
Informations about the package hostinger-php-sdk
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?
- Installation
- API Token
- Usage
- Initialize the Client
- Handle Errors
- Domains
- Availability
- Check Domain Availability
- Portfolio
- Get Domain List
- Availability
- DNS
- Snapshot
- Get Snapshot
- Restore Snapshot
- Get Snapshot List
- Zone
- Get Records
- Update Zone Records
- Delete Zone Records
- Validate Zone Records
- Reset Zone Records
- Snapshot
- Billing
- Catalog
- Get Catalog Item List
- Orders
- Create New Service Order
- Payment Methods
- Set Default Payment Method
- Delete Payment Method
- Get Payment Method List
- Subscriptions
- Cancel Subscription
- Get Subscription List
- Catalog
- VPS
- Actions
- Get Action
- Get Action List
- Backups
- Delete Backup
- Get Backup List
- Restore Backup
- Data Centers
- Get Data Centers List
- PTR Records
- Create PTR Record
- Delete PTR Record
- Firewall
- Activate Firewall
- Deactivate Firewall
- Get Firewall
- Delete Firewall
- Get Firewall List
- Create New Firewall
- Update Firewall Rule
- Delete Firewall Rule
- Create Firewall Rule
- Sync Firewall
- Malware Scanner
- Get Scan Metrics
- Install Monarx
- Uninstall Monarx
- OS Templates
- Get Template
- Get Template List
- Post-Install Scripts
- Get Post-Install Script
- Update Post-Install Script
- Delete a Post-Install Script
- Get Post-Install Script List
- Create Post-Install Script
- Public Keys
- Attach Public Key
- Delete a Public Key
- Get Public Key List
- Create New Public Key
- Recovery
- Start Recovery Mode
- Stop Recovery Mode
- Snapshots
- Get Snapshot
- Create Snapshot
- Delete Snapshot
- Restore Snapshot
- Virtual Machine
- Get Attached Public Keys
- Set Hostname
- Reset Hostname
- Get Virtual Machine
- Get Virtual Machine List
- Get Metrics
- Set Nameservers
- Set Panel Password
- Recreate Virtual Machine
- Restart Virtual Machine
- Set Root Password
- Setup New Virtual Machine
- Start Virtual Machine
- Stop Virtual Machine
- Actions
- Testing
- Contributing
- Credits
- License
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
- Derrick Obedgiu
- All Contributors
License
The MIT License (MIT). Please see the License File for more information.