Last active
March 17, 2019 13:25
-
-
Save Th3Shadowbroker/2d5593dec2c3590b3e2b4eb2ca6b072c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'SpigetAPI.php'; | |
use de\m4taiori\spiget4php\SpigetAPI as SpigetAPI; | |
//Yes you can use 'new' but getInstance() is a better way because you don't have to create a ton of instances. | |
$spiget = SpigetAPI::getInstance(); | |
/* | |
* Some functions use optional arguments/parameters. Use null if you want to use the default value | |
* defined by the spiget-web-api. | |
* | |
* Nearly all functions in this lib throw SpigetExceptions if something's going horribly wrong or is just invalid. However | |
* if you want to receive nulls instead of exceptions you can disable exceptions by using setThrowExceptions() | |
* at any time. | |
*/ | |
//Let's get a list of the categories | |
$categories = $spiget->getCategoryList(); | |
//All results will be returned as PHP assoc.-array | |
var_dump($categories); //<-- Let's see the result as it is in PHP | |
/* | |
* There's also a package if you want to use a more objective approach. | |
* Simply add th3shadowbroker/spiget4php-obj as a dependency. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment