rayblair / spacetradersphp
用PHP编写的spacetraders.io API包装器
0.1.0
2021-03-24 21:48 UTC
Requires
- php: ^7.4|^8.0
- guzzlehttp/guzzle: ^7.2
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-25 15:27:07 UTC
README
用PHP编写的spacetraders.io API包装器。
安装
您可以通过composer安装此包
composer require rayblair/spacetradersphp
示例
// Include composer autoload, if required require __DIR__ . '/vendor/autoload.php'; // Import the SpaceTradersPHP class use RayBlair\SpaceTradersPHP\SpaceTradersPHP; // Initial a client instance $client = new SpaceTradersPHP('token', 'username'); // Will return the game status echo $client->game->status()->status; // kill php script die();
使用
// Include composer autoload, if required require 'vendor/autoload.php'; // Import the SpaceTradersPHP class use RayBlair\SpaceTradersPHP\SpaceTradersPHP; // Initial a client instance $client = new SpaceTradersPHP('token', 'username'); // Get Game Status $client->game->status(); // Create User Token $client->users->token('username'); // Show User $client->users->get('username'); // Get All Active Flight Plans $client->flightPlans->all('OE'); // Get existing Flight Plan $client->flightPlans->get('username', 'flight_plan_id'); // Create Flight Plan $client->flightPlans->create('username', 'ship_id', 'destination'); // Get available loans $client->loans->all(); // Get loans $client->loans->get('username'); // Takeout loan $client->loans->takeout('username', 'STARTUP'); // Payoff loan $client->loans->payoff('username', 'loan_id'); // Get Location $client->locations->get('OE-UC'); // Get Ships at Location $client->locations->ships('OE-UC'); // Get Locations in System $client->systems->all(); // Get Locations in System $client->systems->get('OE'); // Get Marketplace in Location $client->locations->marketplace('OE-UC'); // Purchase Order $client->orders->purchase('username', 'ship_id', 'FUEL', 20); // Sell Order $client->orders->sell('username', 'ship_id', 'FUEL', 20); // Show All Ships $client->ships->all(); // Show Player's Ships $client->ships->get(); // Get Ship by ID $client->ships->get('ship_id'); // Purchase Ship $client->ships->purchase('username', 'OE-PM-TR', 'JW-MK-I'); // Jettison Ship's Cargo $client->ships->jettison('username', 'ship_id', 'FUEL', 20); // Scrap Ship $client->ships->scrap('username', 'ship_id');
测试
composer test
变更日志
有关最近更改的更多信息,请参阅变更日志。
贡献
有关详细信息,请参阅贡献指南。
安全漏洞
请参阅我们的安全策略了解如何报告安全漏洞。
鸣谢
许可协议
MIT许可(MIT)。有关更多信息,请参阅许可文件。