PHPackages                             alejandro-ap00/space-traders-php-sdk - 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. alejandro-ap00/space-traders-php-sdk

ActiveLibrary

alejandro-ap00/space-traders-php-sdk
====================================

A Space Traders SDK for PHP

v0.7.4(1y ago)017[2 PRs](https://github.com/Alejandro-AP00/space-traders-php-sdk/pulls)MITPHPPHP ^8.1

Since Jun 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Alejandro-AP00/space-traders-php-sdk)[ Packagist](https://packagist.org/packages/alejandro-ap00/space-traders-php-sdk)[ Docs](https://github.com/alejandroaporras/space-traders-php-sdk)[ GitHub Sponsors](https://github.com/AlejandroAPorras)[ RSS](/packages/alejandro-ap00-space-traders-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (15)Used By (0)

A Space Traders SDK for PHP
===========================

[](#a-space-traders-sdk-for-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/47a09818eb6802a21bac791f8e49a23048faa2e1e7f6f92f11efcdc6e9ac1964/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c656a616e64726f2d617030302f73706163652d747261646572732d7068702d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alejandro-ap00/space-traders-php-sdk)[![Tests](https://camo.githubusercontent.com/ff6f40a95f21a69ef7a2b06559f6f6769987c98f106da7059adae279d626d80b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416c656a616e64726f2d415030302f73706163652d747261646572732d7068702d73646b2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/Alejandro-AP00/space-traders-php-sdk/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/a46d9eb18df7c74f0cbe973e29aca58ffc3ccc9b63b9ab5511eba9be15cb0d2b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c656a616e64726f2d617030302f73706163652d747261646572732d7068702d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alejandro-ap00/space-traders-php-sdk)

An PHP SDK for the [SpaceTraders](https://spacetraders.io/) API this package provides an expressive way to interact with all endpoints available.

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

[](#installation)

You can install the package via composer:

```
composer require alejandro-ap00/space-traders-php-sdk
```

Usage
-----

[](#usage)

To get started, please create an instance of the SDK

```
use AlejandroAPorras\SpaceTraders;

$space_traders = new SpaceTraders('Your JWT bearer token');
```

### Handling Pagination

[](#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 loop
- `next()`: fetch the next page of results
- `previous()`: fetch the previous page of results
- `currentPage()`: get the current page number
- `total()`: get the total number of results across all pages
- `totalPages()`: get the total number of pages
- `nextPage()`: get the page number for the next page of results
- `previousPage()`: get the page number for the previous page of results

### Registering

[](#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

[](#getting-api-status)

```
$space_traders->getStatus();
```

### Managing Contracts

[](#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

[](#managing-agents)

```
$space_traders->agent();
$space_traders->agents(['page' => 1]);
$space_traders->publicAgent(string $agent);
```

### Managing Factions

[](#managing-factions)

```
$space_traders->factions(['page' => 1]);
$space_traders->faction();
```

### Managing Fleet

[](#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

[](#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
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Alejandro A](https://github.com/Alejandro-AP00)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance42

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94% 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

Every ~30 days

Recently: every ~79 days

Total

12

Last Release

368d ago

Major Versions

v0.7.4 → v1.0.0-alpha2025-05-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/800464c40f2c53161239278eee23923c7d07ac86ec47e0a0d68ea3780c62630d?d=identicon)[AlejandroAP00](/maintainers/AlejandroAP00)

---

Top Contributors

[![Alejandro-AP00](https://avatars.githubusercontent.com/u/6068791?v=4)](https://github.com/Alejandro-AP00 "Alejandro-AP00 (47 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

Alejandro Aspace-traders-php-sdk

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/alejandro-ap00-space-traders-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/alejandro-ap00-space-traders-php-sdk/health.svg)](https://phpackages.com/packages/alejandro-ap00-space-traders-php-sdk)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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