PHP code example of prepaid-hoster / laravel-pph-api-client

1. Go to this page and download the library: Download prepaid-hoster/laravel-pph-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

prepaid-hoster / laravel-pph-api-client example snippets


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