alejandro-ap00/space-traders-php-sdk
Composer 安装命令:
composer require alejandro-ap00/space-traders-php-sdk
包简介
A Space Traders SDK for PHP
README 文档
README
An PHP SDK for the SpaceTraders API this package provides an expressive way to interact with all endpoints available.
Installation
You can install the package via composer:
composer require alejandro-ap00/space-traders-php-sdk
Usage
To get started, please create an instance of the SDK
use AlejandroAPorras\SpaceTraders; $space_traders = new SpaceTraders('Your JWT bearer token');
Handling Pagination
There are several methods, such as agents(), contracts() and ships() to will return paginated results. To
get the next page of results just call next() on a result. If there are no more results, that method returns null.
On paginated results, there are also some more convenience methods:
results(): get the results. A results object is also iterable, so you can also get to the results by simply using the object in a loopnext(): fetch the next page of resultsprevious(): fetch the previous page of resultscurrentPage(): get the current page numbertotal(): get the total number of results across all pagestotalPages(): get the total number of pagesnextPage(): get the page number for the next page of resultspreviousPage(): get the page number for the previous page of results
Registering
You can generate a new token using the register method
use AlejandroAPorras\SpaceTraders\Enums\FactionSymbol; $space_traders->register(FactionSymbol::COSMIC, 'T3ST_US3R', 'your@email.com')
Getting API status
$space_traders->getStatus();
Managing Contracts
$space_traders->contracts(['page' => 1]); $space_traders->contract(string $contractId); $space_traders->acceptContract(string $contractId); $space_traders->deliverContract(string $contractId, string $shipSymbol, TradeGoodSymbol $tradeSymbol, int $units); $space_traders->fulfillContract(string $contractId);
On a Contract instance you can call
$contract->accept(); $contract->deliver(string $shipSymbol, TradeGoodSymbol $tradeSymbol, int $units); $contract->fulfill();
Managing Agents
$space_traders->agent(); $space_traders->agents(['page' => 1]); $space_traders->publicAgent(string $agent);
Managing Factions
$space_traders->factions(['page' => 1]); $space_traders->faction();
Managing Fleet
$space_traders->ships(['page' => 1]); $space_traders->purchaseShip(ShipType $shipType, string $waypointSymbol); $space_traders->ship(string $shipSymbol); $space_traders->shipCargo(string $shipSymbol); $space_traders->orbitShip(string $shipSymbol); $space_traders->refineShip(string $shipSymbol, ProduceType $produce); $space_traders->chartShip(string $shipSymbol); $space_traders->shipCooldown(string $shipSymbol); $space_traders->dockShip(string $shipSymbol); $space_traders->createSurvey(string $shipSymbol); $space_traders->extractResources(string $shipSymbol); $space_traders->createSurvey(string $shipSymbol); $space_traders->siphonResources(string $shipSymbol); $space_traders->extractResourcesWithSurvey(string $shipSymbol, Survey $survey); $space_traders->jettisonCargo(string $shipSymbol, TradeGoodSymbol $symbol, int $units); $space_traders->jumpShip(string $shipSymbol, string $waypointSymbol); $space_traders->navigateShip(string $shipSymbol, string $waypointSymbol); $space_traders->patchShipNav(string $shipSymbol, ShipNavFlightMode $flightMode); $space_traders->shipNav(string $shipSymbol); $space_traders->warpShip(string $shipSymbol, string $waypointSymbol); $space_traders->sellCargo(string $shipSymbol, TradeGoodSymbol $symbol, int $units); $space_traders->scanSystems(string $shipSymbol); $space_traders->scanWaypoints(string $shipSymbol); $space_traders->scanShips(string $shipSymbol); $space_traders->refuelShip(string $shipSymbol, int $units, bool $fromCargo = false); $space_traders->purchaseCargo(string $shipSymbol, TradeGoodSymbol $symbol, int $units); $space_traders->transferCargo(string $shipSymbol, TradeGoodSymbol $symbol, int $units, string $transferShipSymbol); $space_traders->negotiateContract(string $shipSymbol); $space_traders->shipMounts(string $shipSymbol); $space_traders->installShipMount(string $shipSymbol, string $mountSymbol); $space_traders->removeShipMount(string $shipSymbol, string $mountSymbol); $space_traders->scrapShipValue(string $shipSymbol); $space_traders->scrapShip(string $shipSymbol); $space_traders->repairShipValue(string $shipSymbol); $space_traders->repairShip(string $shipSymbol);
On a Ship instance you can call
$ship->cargo(); $ship->orbit(); $ship->refine(ProduceType $produce); $ship->chart(); $ship->cooldown(); $ship->dock(); $ship->survey(); $ship->extractResources(); $ship->siphonResources(); $ship->extractResourcesWithSurvey(Survey $survey); $ship->jettisonCargo(TradeGoodSymbol $tradeGoodSymbol, int $units); $ship->jump(string $waypointSymbol); $ship->navigate(string $waypointSymbol); $ship->patchNav(ShipNavFlightMode $flightMode); $ship->nav(); $ship->warp(string $waypointSymbol); $ship->sellCargo(TradeGoodSymbol $tradeGoodSymbol, int $units); $ship->scanSystems(); $ship->scanWaypoints(); $ship->scanShips(); $ship->refuel(int $units, bool $fromCargo = false); $ship->purchaseCargo(TradeGoodSymbol $tradeGoodSymbol, int $units); $ship->transferCargo(TradeGoodSymbol $tradeGoodSymbol, int $units, string $transferShipSymbol); $ship->negotiateContract(); $ship->mounts(); $ship->installMount(string $mountSymbol); $ship->removeMount(string $mountSymbol); $ship->scrapValue(); $ship->scrap(); $ship->repairValue(); $ship->repair();
Managing Systems
$space_traders->systems(['page' => 1]); $space_traders->system(string $systemSymbol); $space_traders->waypoints(string $systemSymbol, ['page' => 1]); $space_traders->waypoint(string $systemSymbol, string $waypointSymbol); $space_traders->market(string $systemSymbol, string $waypointSymbol); $space_traders->shipyard(string $systemSymbol, string $waypointSymbol); $space_traders->jumpGate(string $systemSymbol, string $waypointSymbol); $space_traders->construction(string $systemSymbol, string $waypointSymbol); $space_traders->supplyConstruction(string $systemSymbol, string $waypointSymbol, string $shipSymbol, TradeGoodSymbol $tradeSymbol, int $units);
On a System instance you can call
$system->waypoints();
and in a Waypoint instance you can call
$waypoint->market(); $waypoint->shipyard(); $waypoint->jumpGate(); $waypoint->construction(); $waypoint->supplyConstruction(string $shipSymbol, TradeGoodSymbol $tradeSymbol, int $units);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
alejandro-ap00/space-traders-php-sdk 适用场景与选型建议
alejandro-ap00/space-traders-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 06 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Alejandro A」 「space-traders-php-sdk」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alejandro-ap00/space-traders-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alejandro-ap00/space-traders-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alejandro-ap00/space-traders-php-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-09