PHPackages                             th3shadowbroker/spiget4php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. th3shadowbroker/spiget4php

ActiveLibrary

th3shadowbroker/spiget4php
==========================

PHP-wrapper for the spiget.org-api.

v1.0.5(6y ago)176[1 issues](https://github.com/Th3Shadowbroker/Spiget4PHP/issues)1MITPHP

Since Jul 1Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Th3Shadowbroker/Spiget4PHP)[ Packagist](https://packagist.org/packages/th3shadowbroker/spiget4php)[ RSS](/packages/th3shadowbroker-spiget4php/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (6)DependenciesVersions (6)Used By (1)

Spiget4PHP
==========

[](#spiget4php)

Spiget4PHP is a PHP-wrapper for the Spiget-API created by inventivetalent ([GitHub](https://github.com/inventivetalentDev) | [Website](https://inventivetalent.org))

Composer
--------

[](#composer)

You can install the Spiget4PHP core using composer ([View on packagist](https://packagist.org/packages/th3shadowbroker/spiget4php)):

```
composer require th3shadowbroker/spiget4php

```

If you want to work more object-oriented it's recommended to install the obj-package too. ([View on packagist](https://packagist.org/packages/th3shadowbroker/spiget4php-obj) | [Git](https://github.com/th3shadowbroker/spiget4php-obj))

```
composer require th3shadowbroker/spiget4php-obj

```

Example
-------

[](#example)

```
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); //
