PHPackages                             rayblair/spacetradersphp - 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. [API Development](/categories/api)
4. /
5. rayblair/spacetradersphp

ActiveLibrary[API Development](/categories/api)

rayblair/spacetradersphp
========================

An API Wrapper for spacetraders.io written in PHP

0.1.0(5y ago)629MITPHPPHP ^7.4|^8.0

Since Mar 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/rayblair06/SpaceTradersPHP)[ Packagist](https://packagist.org/packages/rayblair/spacetradersphp)[ Docs](https://github.com/rayblair/spacetradersphp)[ RSS](/packages/rayblair-spacetradersphp/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

SpacetradersPHP
===============

[](#spacetradersphp)

[![Latest Version on Packagist](https://camo.githubusercontent.com/67b91fc62d54ee3f1f599c2a0e5e4374911a083962f0915f9ac31fe30150052d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726179626c6169722f5370616365747261646572735048502e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rayblair/SpacetradersPHP)[![GitHub Tests Action Status](https://camo.githubusercontent.com/9da57d6a0474fc2aa4193233132bb004033c588b9723ffa08e855d6e8cfc4405/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f726179626c6169722f5370616365747261646572735048502f54657374733f6c6162656c3d7465737473)](https://github.com/rayblair/SpacetradersPHP/actions?query=workflow%3ATests+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/668b63b377194c0f0833e80c49aa90f09c17b67f7ce5d98faa1c369cb420a6c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726179626c6169722f5370616365747261646572735048502e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rayblair/SpacetradersPHP)

An API Wrapper for spacetraders.io written in PHP.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require rayblair/spacetradersphp
```

Example
-------

[](#example)

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

Usage
-----

[](#usage)

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

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ray Blair](https://github.com/rayblair06)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1872d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab35ad2244c1203e3b7f0fdbe2d765fcdcf92c4b51cddee2b82e522c841f4650?d=identicon)[rayblair06](/maintainers/rayblair06)

---

Top Contributors

[![rayblair06](https://avatars.githubusercontent.com/u/16214725?v=4)](https://github.com/rayblair06 "rayblair06 (2 commits)")

---

Tags

phpspacetradersrayblairSpacetradersPHP

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rayblair-spacetradersphp/health.svg)

```
[![Health](https://phpackages.com/badges/rayblair-spacetradersphp/health.svg)](https://phpackages.com/packages/rayblair-spacetradersphp)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
