class PostSource

How a post reached the forum when it was not written in the forum's own interface: through the API, an MCP client, or a channel an extension adds.

Put it on the request with {[\Flarum\Http\RequestUtil::withPostSource()} and](../../Flarum/Http/RequestUtil.html) posts created during that request record it. The forum shows it next to the author as "via ".

Constants

API

Posts made through the REST API with an API key or access token.

MAX_KEY_LENGTH

MAX_NAME_LENGTH

Methods

__construct(string $key, string|null $name = null)

No description

string|null
storedName()

The name as stored: trimmed, null when blank, and cut to the column's length.

Details

__construct(string $key, string|null $name = null)

Parameters

string $key A short, lowercase identifier that search filters on, such as `api` or `mcp`.
string|null $name What the forum shows after "via", when the key's own label is not enough (e.g. an application's name). Kept as it was when the post was made.

string|null storedName()

The name as stored: trimmed, null when blank, and cut to the column's length.

Return Value

string|null