prepaid-hoster / laravel-pph-api-client
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/prepaid-hoster/laravel-pph-api-client
README
This package provides a simple way to communicate with the Prepaid Hoster API. It is a wrapper around the GuzzleHttp library, which provides a simple way to communicate with servers via HTTP.
Installation
composer require prepaid-hoster/laravel-pph-api-client
Usage
First, update your .env file with the following variables:
PPH_API_KEY="your-api-key"
Then, you can use the package like this:
public function testGetHostings() { // Automatically injects the API key from the .env file $client = app(ApiClient::class); // Get all hostings, with the alternative server 'fsn-01' $response = $client ->withAlt('fsn-01') ->get('/client/hostings'); // Get the first hosting ID $firstHosting = $response->get('data.0.id'); // Get the complete hosting information $completeHosting = $client->get("/client/hostings/{$firstHosting}"); dd($completeHosting->all()); }