Looking to hire Laravel developers? Try LaraJobs
This package is not available.

laravel-pph-api-client maintained by prepaid-hoster

Last update
2025/02/23 13:30 (dev-main)
Links
Downloads
2

Comments
comments powered by Disqus

Prepaid Hoster API Client for Laravel

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