prepaid-hoster/laravel-pph-api-client

There is no license information available for the latest version (v1.0.3) of this package.

v1.0.3 2025-02-23 12:29 UTC

This package is not auto-updated.

Last update: 2025-08-11 13:30:20 UTC


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());
    }