stedop/starcitizens

sc-api.com API 的 API 包装器。

v1.1 2016-04-09 16:16 UTC

This package is not auto-updated.

Last update: 2024-09-24 18:56:24 UTC


README

Scrutinizer Code Quality Code Coverage Build Status Documentation Status Release License

StarCitizen API 包装器。利用 http://sc-api.com 的 API

安装

您可以使用 Composer 安装此框架,只需安装 Composer,然后在项目根目录下命令行中输入

composer require stedop/starcitizen ~1.0

然后您就可以开始了

使用

要获取信息

use StarCitizen\Accounts\Accounts;

$profile = Accounts::findProfile(<userName>);
$threads = Accounts::findThreads(<userName>);
$posts = Accounts::findPosts(<userName>);

use StarCitizen\Organisations\Organisations;

$org = Organisations::findOrg(<orgName>);
$members = Organisations::findMembers(<orgName>);

获取一些信息后加载其他对象

如果您想获取个人资料的最新帖子或线程

$profile = Accounts::findProfile(<userName>);

/*
    ...some code
*/

$posts = $profile->posts;
$threads = $profile->threads;

$members = $org->members;

这会返回帖子或线程,您不需要将帖子或线程分配给变量,只需直接使用

foreach ($profile->posts as $post) {
    // ....your code
}

预加载

如果您想在找到个人资料时加载对象

$profile = Accounts::findProfile(<userName>)->with('posts', 'threads');
$org = Organisations::findOrg(<orgName>)->with('members');

直接使用 StarCitizens

您可以直接使用 StarCitizens 对象

use StarCitizens\StarCitizens
$sc = new StarCitizens();

$profile = $sc->accounts(<username>);
$threads = $sc->accounts(<username>, 'threads')

也可以获取原始 json 输出

$profile = $sc->accounts(<username>, '',true);

请查看代码以获取更多信息

贡献

  1. 分叉它!
  2. 创建您的功能分支:git checkout -b my-new-feature
  3. 提交您的更改:git commit -am '添加一些功能'
  4. 将更改推送到分支:git push origin my-new-feature
  5. 提交拉取请求 :D

致谢

感谢 RSI 论坛上的 Siegen 构建了 API(我很高兴我不用这么做)

许可

本项目根据 MIT 许可证的条款进行许可。

版权(c)2015 Stephen Dop

特此授予任何获得本软件及其相关文档副本(以下简称“软件”)的人免费使用该软件的权利,不受任何限制,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本的权利,并允许向提供软件的人授予此类权利,前提是遵守以下条件

上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。

软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、特定用途适用性和非侵权性保证。在任何情况下,作者或版权持有人不对任何索赔、损害或其他责任负责,无论此类索赔、损害或其他责任是基于合同、侵权或其他原因,是否与软件或其使用或其他方式有关。