th3shadowbroker/spiget4php

spiget.org-api的PHP包装器。

v1.0.5 2019-07-22 07:28 UTC

This package is auto-updated.

Last update: 2024-09-22 19:28:57 UTC


README

Spiget4PHP是由inventivetalent(GitHub | 网站)创建的Spiget-API的PHP包装器。

Composer

您可以使用composer安装Spiget4PHP核心(在Packagist上查看 View on packagist

composer require th3shadowbroker/spiget4php

如果您想更加面向对象,建议安装obj-package。在Packagist上查看(View on packagist | Git

composer require th3shadowbroker/spiget4php-obj

示例

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

建议和问题

如果您有任何建议或想报告问题,不要害怕使用问题跟踪器。然而,大多数时候我无法处理我的“空闲时间项目”,所以如果您只是纠正了错误,也可以提交pull-request :octocat:

未来计划

我已经计划实现了Spiget提供的webhook支持。由于目前我的需求中不需要,所以我还没有实现webhook支持。

文档

如果您想了解更多关于Spiget4PHP的信息,请访问docs

联系方式

在社交媒体上关注我或给我发消息