Skip to content

lemonfiber/sdk-php

A PHP client for the web API that lemonfiber serves. For PHP applications that read or control a lemonfiber media stack, on the same machine or, with the stack’s certificate pinned, from another one.

It gives you a typed class for every kind of answer, typed exceptions for every failure, and a live event stream that marks values from before a dropped connection as stale.

Not on Packagist. There is no release yet; install it from GitHub at a commit.

  • PHP 8.5 with the filter, json and openssl extensions.
  • lemonfiber, serving its web API with lemonfiber ui.

The runtime dependencies are Saloon 4 and Guzzle 8.

Pin a commit from the commit list:

Terminal window
composer config repositories.lemonfiber-sdk vcs https://github.com/lemonfiber/sdk-php
composer require "lemonfiber/sdk-php:dev-main#<commit>"

Start lemonfiber’s web API. It prints the address and a token for this run:

Terminal window
$ lemonfiber ui --port 9000 --no-browser
lemonfiber is serving at:
http://[::1]:9000
http://127.0.0.1:9000
…
The token for this run, which the page will ask you for:
<token>

Then ask it how the stack is doing. Save this as status.php:

<?php
require __DIR__ . '/vendor/autoload.php';
use Lemonfiber\Sdk\Client;
use Lemonfiber\Sdk\Contract\Api;
use Lemonfiber\Sdk\Generated\StatusEnvelope;
use Lemonfiber\Sdk\Time\Duration;
$client = Client::onPort(9000, (string) getenv('LEMONFIBER_TOKEN'), Duration::ofSeconds(10));
$status = StatusEnvelope::in($client->read(Api::STATUS_ENDPOINT));
echo $status->data['condition'], ' ', implode(', ', $status->data['active_forms']), PHP_EOL;

Run it with the token lemonfiber printed:

Terminal window
$ LEMONFIBER_TOKEN=<token> php status.php
active library

That is the output with only the library form running and healthy. A form is a named part of the stack, such as library or tv; see forms.

A failure is an exception: Unreachable when nothing answered, RequestFailed when lemonfiber answered and refused. Each carries a sentence you can show a person.

  • The guide: connecting from another machine, signing in with a password, actions and repairs, jobs, logs, the live event stream, every exception and testing with a mock.
  • The web API: the envelope every answer arrives in, every payload kind and the field-by-field reference.
  • The command reference: every read and action is a command, and takes the same arguments.
  • The changelog: every change, generated from the commit history by composer changelog.
Terminal window
composer install # also turns on the git hooks
composer ci # every gate CI runs except backward compatibility

The gates, and the rules they hold the code to, are in AGENTS.md. src/Generated/ is generated from lemonfiber’s contract and never edited by hand; the guide says how to regenerate it. Every change cites a requirement in the specification; start with the contributing guide.

Report a vulnerability privately, as the security policy describes. Do not open a public issue.

Hippocratic License 3.0 (HL3-CORE): source-available and ethical-source, not OSI-approved. The licence rationale explains what that means for you. Made by NightWorksIO.

This page lives in another repository Rendered from lemonfiber/sdk-php at 953ec88, 2026-10-27. Read the source of this page