krystal / katapult
v5.4.0
2025-02-03 13:42 UTC
Requires
- php: ^8.1
- jane-php/open-api-runtime: ^7.8
Requires (Dev)
- jane-php/open-api-3: ^7.8
- dev-main
- v5.4.0
- v5.3.2
- v5.3.1
- v5.3.0
- v5.2.0
- v5.1.0
- v5.0.0
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- v3.0.2
- v3.0.1
- v3.0.0
- 2.x-dev
- v2.3.0
- v2.2
- v2.1
- 2.0
- 1.x-dev
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6
- v1.5
- v1.4
- v1.3.1
- v1.3
- v1.2.1
- v1.2
- v1.1
- v1.0
- dev-release-please--branches--main
- dev-chore/update-jane
- dev-chore/test-param-generation
This package is auto-updated.
Last update: 2025-02-03 14:13:58 UTC
README
A PHP library for integrating with Katapult.
You can find all the Katapult Developer Docs here.
Version constraints
From version 3, we switched to an OpenAPI based generator.
Versions 3 and up require a minimum of PHP 8.1 and follow semantic versioning.
Please refer to composer.json
for any specific language requirements for your version.
Installation
You can install the package via Composer:
composer require krystal/katapult
Usage
It will use PSR HTTP discovery to locate an imlpementation of the PSR ClientInterface.
If you need control over this, you can call setHttpClient
in ClientFactory
.
The usage sample below emits the IPv4 and IPv6 addresses for each VM in your Organization.
use KatapultAPI\Core\ClientFactory; $katapult = (new ClientFactory('your-katapult-api-token'))->create(); $virtualMachines = $katapult->getOrganizationVirtualMachines([ 'organization[id]' => 'your-katapult-org-id', ])->getVirtualMachines(); foreach ($virtualMachines as $virtualMachine) { echo $virtualMachine->getHostname() . PHP_EOL; foreach ($virtualMachine->getIpAddresses() as $ipAddress) { $prefix = filter_var($ipAddress->getAddress(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ? 'ipv4' : 'ipv6'; echo ' ' . $prefix . ': ' . $ipAddress->getAddress() . PHP_EOL; } }
Output
example
ipv4: 93.184.216.34
ipv6: 2606:2800:220:1:248:1893:25c8:1946