PHPackages                             dirkolbrich/stockfighter - 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. dirkolbrich/stockfighter

ActiveLibrary[API Development](/categories/api)

dirkolbrich/stockfighter
========================

A wrapper for the stockfighter api

06PHP

Since Jan 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/dirkolbrich/stockfighter-php)[ Packagist](https://packagist.org/packages/dirkolbrich/stockfighter)[ RSS](/packages/dirkolbrich-stockfighter/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Stockfighter PHP API wrapper
============================

[](#stockfighter-php-api-wrapper)

My take on an API wrapper for stockfighter.io

It utilizes two base classes:

`StockfighterApi.php`, which is the minimal wrapper around the REST API of stockfighter.io. It returns the raw json response. See the [stockfighter API documentation](https://starfighter.readme.io/v1.0/docs). You can use this base class for you own implemantation.

`Stockfighter.php` is the actual game wrapper around the API. It depends on `StockfighterApi.php`. The system keeps track of your orders and your account with a list of the transactions, the inventory and your balance.

### Installation

[](#installation)

Install via composer:

```
"require": {
        "dirkolbrich/stockfighter": "*"
}
```

### Usage

[](#usage)

#### API Class

[](#api-class)

To only use the base API class. Provide your API key during instantiation:

```
use DirkOlbrich\Stockfighter\StockfighterApi;

$apiKey = "your API key provided by stockfighter.io";
$api = new StockfighterApi($apiKey);
```

The followings functions are available:

- `heartbeat()` - check if the REST API is up
- `venueHeartbeat($venue)` - check if the venue is up
- `venues()` - get all available venues
- `stocks($venue)` - get all available stocks on a specific venue
- `orders($account, $venue)` - get all orders on a specific venue
- `stockOrders($account, $venue, $stock)` - get all orders for a specific stock on a specific venue
- `orderbook($venue, $stock)` - get the orderbook of a specific stock on a specific venue
- `quote($venue, $stock)` - get the last quote of a specific stock on a specific venue
- `order($venue, $stock, $order)` - place an order, the `$order`param must be a string specified by the REST API
- `cancel($venue, $stock, $orderId)` - cancel an order
- `orderStatus($venue, $stock, $orderId)` - get the status of an order

Requests to the Game Master are available as well (self-explanatory):

- `levels()` - not implemented by the REST API yet
- `start($level)`
- `restart($instanceId)`
- `stop($instanceId)`
- `resume($instanceId)`
- `levelStatus($instanceId)` - get the status of the level

#### Stockfighter System

[](#stockfighter-system)

Or use the `Stockfighter` system:

```
use DirkOlbrich\Stockfighter\Stockfighter;

$apiKey = "your API key provided by stockfighter.io";
$sf = new Stockfighter($apiKey);
```

### Dependencies

[](#dependencies)

So far, it uses these dependencies.

```
"require": {
        "guzzlehttp/guzzle": "~6.0",
}
```

### ToDo

[](#todo)

- integrate web socket client
- tests, tests, tests

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3765119?v=4)[Dirk Olbrich](/maintainers/dirkolbrich)[@dirkolbrich](https://github.com/dirkolbrich)

---

Top Contributors

[![dirkolbrich](https://avatars.githubusercontent.com/u/3765119?v=4)](https://github.com/dirkolbrich "dirkolbrich (13 commits)")

### Embed Badge

![Health badge](/badges/dirkolbrich-stockfighter/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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