Download the PHP package nexo/plugin-sdk without Composer

On this page you can find all versions of the php package nexo/plugin-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package plugin-sdk

nexo/plugin-sdk (PHP)

Child-side SDK for nexo subprocess plugins written in PHP 8.1+. Mirrors the Rust counterpart in crates/microapp-sdk/, the Python counterpart in python/, and the TypeScript counterpart in typescript/. Same wire format (nexo-plugin-contract.md), different language.

The reference plugin template lives at the PHP plugin template (or run nexo plugin new --lang php); copy that directory to start a new plugin.

Public API

Minimal example

Host calls

The $broker handle passed into onEvent can call back into the host — read the agent's long-term memory, or run an LLM completion via the agent's configured providers:

Failures throw an RpcError: RpcServerError (getCode()-32603 = backend/not-configured, -32602 = bad params, -32601 = not wired host-side; $serverMessage = the host's raw message), RpcTimeoutError ($seconds; default 30 s, override per call with 'timeoutSec' => ...), RpcTransportError, RpcDecodeError. Host calls run inside the handler Fiber and Fiber::suspend() until the reply lands, so N concurrent onEvent handlers can each have a call in flight.

Robustness defaults

The constructor defaults are picked to make the most common plugin-author mistakes recoverable rather than fatal:

Default What it gives you
enableStdoutGuard: true ob_start callback diverts every non-JSON echo / print / printf / var_dump line to stderr tagged with [stdout-guard] rather than corrupting the JSON-RPC frame stream the host parses.
maxFrameBytes: 1048576 Inbound JSON-RPC frames larger than 1 MiB are rejected with a WireError log; dispatch continues. Adversarial host cannot OOM the plugin via a single huge line.
handleProcessSignals: true Ctrl-C / SIGTERM trigger a graceful shutdown via pcntl_async_signals — in-flight Fibers are drained (no mid-publish cancellation), then the process exits 0.
In-flight Fiber drain on shutdown Handlers spawned for broker.event run in Fibers tracked by the scheduler; Scheduler::drain() resumes them all to completion before the SDK replies {ok: true} to a host's shutdown request. Same idiom as the Python SDK's _drain_inflight and the TypeScript SDK's Promise.allSettled([...inflight]).

Stdout guard limitation

fwrite(STDOUT, $x) direct writes BYPASS the guard (PHP ob_start only intercepts the buffered output API: echo, print, printf, var_dump). The SDK's own BrokerSender::publish() uses direct fwrite deliberately so blessed JSON frames always reach the host even when the guard is active. Plugin authors who need stdout output should use echo / print / printf — those are guarded. Calling fwrite(STDOUT, ...) directly from author code is undefined behavior.

What the daemon expects

Method Direction Reply
initialize host → child { manifest, server_version } automatically — the SDK reads + caches your manifest TOML at construction time.
broker.event (notification) host → child No JSON reply. Your onEvent handler runs in a Fiber so the dispatch loop continues reading stdin while the handler awaits broker round-trips. Author code can call Fiber::suspend() at await points to yield control.
shutdown host → child { ok: true } after draining in-flight Fibers + invoking your onShutdown (if set).
memory.recall / llm.complete (+ llm.complete.delta) child → host Issued by $broker->memoryRecall / llmComplete / llmCompleteStream — the SDK assigns the request id, Fiber-suspends until the reply lands, and multiplexes concurrent calls.

Full spec: nexo-plugin-contract.md.

Tests

23 test cases across 8 files covering:

Phase tracking


All versions of plugin-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
yosymfony/toml Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nexo/plugin-sdk contains the following files

Loading the files please wait ...