PHP code example of gamepanelio / spiget-api

1. Go to this page and download the library: Download gamepanelio/spiget-api 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/ */

    

gamepanelio / spiget-api example snippets




use GamePanelio\SpigetApi\Spiget;

$spiget = new Spiget("My_cool_user_agent/1.0");

$response = $spiget->getResourceSearch(
    'search_param',
    [
        /* ... additional parameters ... */
    ]
);

$response = $spiget->getResourcesList();

// To get the response data
var_dump($spiget->getResponseBodyFromJson($response));
// or
var_dump(json_decode($response->getBody(), true));


// To get the page count, etc
var_dump($response->getHeaderLine('X-Page-Count'));
bash
  composer