Index

KanbanController

MMO\client\controllers · 1 symbol · generated 5 Oct 2026

class

KanbanController

KanbanController.php:51

The JSON API of <mmo-kanban> boards, over any repository holding KanbanBoard, KanbanTicket and

class MMO\client\controllers\KanbanController extends MMO\core\classes\aDataController
Namespace
MMO\client\controllers
Extends
aDataController
See
KanbanComment entities: a JsonRepository in local files, a database, or one reaching another service (mmo.git's GitHubRepository). It reads the board from the repository, and commits the board's changes to it.
```php \MMO\app([ \MMO\core\Application::class => ['routes' => [\MMO\client\controllers\KanbanController::class => []]], 'kanban' => ['$' => \MMO\core\entities\JsonRepository::class, 'filenames' => ['boards' => '{root}/data/boards.json', 'tickets' => '{root}/data/tickets.json', 'comments' => '{root}/data/comments.json'], 'collections' => ['boards' => KanbanBoard::class, 'tickets' => KanbanTicket::class, 'comments' => KanbanComment::class]], \MMO\client\controllers\KanbanController::class => ['repositories' => ['main' => ['$' => '#kanban']]], ]); ``` - `GET kanban/{board}.json` answers `{title, url, writable, data}`: `data` is the board's, as `<mmo-kanban>`'s `data` takes it. A board the repository does not hold yet is empty, and made by its first save. - `PUT kanban/{board}.json` takes `{before, after}`: the data the page was given, and the board's data now. Only what differs between the two changes, so what someone else changed meanwhile stays; it answers as `GET` does, with `ids`: the id each new ticket got, by the id the board gave it. - `GET kanban/{board}/prompts.json` answers the AI prompts of its tickets -- their description's ```` ```claude ````, ```` ```chatgpt ````... blocks -- for an agent to treat them ([`KanbanPrompts::Answer`](https://mcp.mmoframework.fr/documentation/mmo.client/php/classes/KanbanPrompts.md#kanbanprompts-answer): `?agent=claude`, `&status=todo`, `&done=1`), as a list and as a markdown brief. It reports back with a comment. - `kanban/{board}/{ticket}/comments.json` (`GET`; `POST {body, parent}`) and `kanban/{board}/{ticket}/comments/{comment}.json` (`PUT {body}`, `DELETE`) are a ticket's discussion: the page gives them to the board as its `discussion`. Only its author changes or deletes a comment. Who is looking (the author of a new comment, whose comments are `mine`) is [`$user`](https://mcp.mmoframework.fr/documentation/mmo.client/php/controllers/KanbanController.md#kanbancontroller-user), unless the repository knows better: a repository with a `getViewer()` (GitHub's: the token's owner) answers it. A repository with an `isWritable()` says whether the board can be saved. > WARNING: it checks no one's rights. Put it behind a login, or keep it on localhost.
curl http://localhost/app/kanban/main.json curl -X POST -H 'Content-Type: application/json' -d '{"body": "Done?", "parent": null}' http://localhost/app/kanban/main/12/comments.json

Properties2

readonly

bool $readonly = false
Type
bool

user

array $user = ['login' => 'me', 'name' => 'Me']
Type
array

Methods21

answer($name)

KanbanController.php:157
protected function answer(string $name): array
$namestring
returnsarray{title, url, writable, data}: the board, as the repository has it now

collection($class)

KanbanController.php:289
protected function collection(string $class): MMO\core\interfaces\iCollection
$classstring
returnsiCollectionthe main repository's collection of $class
throwswhen it has none

mine($route)

KanbanController.php:255
protected function mine(MMO\core\server\Route $route): MMO\client\entities\KanbanComment|array
$routeRoute
returnsKanbanComment | arraythe route's comment, when the viewer wrote it; else the error to answer

remap($ticket, $ids)

KanbanController.php:325

Give the tickets a new ticket's id where they name it by the board's.

protected function remap(array $ticket, array $ids): array
$ticketarray
$idsarray
returnsarray

routeComment($route)

KanbanController.php:191
#[MMO\core\attributes\APIRoute('POST|kanban/{board}/{ticket}/comments.json', 'Comment on a kanban ticket, or answer one of its comments: {body, parent}', mediaTypes: ['json'])] function routeComment(MMO\core\server\Route $route): array
$routeRoutea JSON body {body, parent}: markdown, and the id of the comment it answers (null for none)
returnsarray{comment}: the new comment

routeComments($route)

KanbanController.php:177
#[MMO\core\attributes\APIRoute('GET|kanban/{board}/{ticket}/comments.json', 'A kanban ticket\'s discussion', mediaTypes: ['json'])] function routeComments(MMO\core\server\Route $route): array
$routeRoute
returnsarray{comments}: the ticket's comments, oldest first; {error} when the repository refused

routeDeleteComment($route)

KanbanController.php:239
#[MMO\core\attributes\APIRoute('DELETE|kanban/{board}/{ticket}/comments/{comment}.json', 'Delete your comment', mediaTypes: ['json'])] function routeDeleteComment(MMO\core\server\Route $route): array
$routeRoute
returnsarray{}

routeLoad($route)

KanbanController.php:65
#[MMO\core\attributes\APIRoute('GET|kanban/{board}.json', 'A kanban board, as <mmo-kanban> takes it', mediaTypes: ['json'])] function routeLoad(MMO\core\server\Route $route): array
$routeRoute
returnsarray{title, url, writable, data}

routePrompts($route)

KanbanController.php:147
#[MMO\core\attributes\APIRoute('GET|kanban/{board}/prompts.json', 'The AI prompts of a kanban board\'s tickets: ?agent=claude&status=todo&done=1', mediaTypes: ['json'])] function routePrompts(MMO\core\server\Route $route): array
$routeRouteits query: agent, status, done (KanbanPrompts::Answer)
returnsarray{board, agents, prompts: [{agent, info, prompt, line, ticket}], markdown}

routeSave($route)

KanbanController.php:74
#[MMO\core\attributes\APIRoute('PUT|kanban/{board}.json', 'Save a kanban board\'s changes: {before, after}', mediaTypes: ['json'])] function routeSave(MMO\core\server\Route $route): array
$routeRoutea JSON body {before, after}
returnsarray{title, url, writable, data, ids}; {error} when the board cannot be saved

routeUpdateComment($route)

KanbanController.php:220
#[MMO\core\attributes\APIRoute('PUT|kanban/{board}/{ticket}/comments/{comment}.json', 'Change your comment: {body}', mediaTypes: ['json'])] function routeUpdateComment(MMO\core\server\Route $route): array
$routeRoutea JSON body {body}
returnsarray{comment}: the comment as it is now

save($name, $before, $after)

KanbanController.php:95

Make the changes from $before to $after on the board and its tickets, and commit them.

function save(string $name, array $before, array $after): array
$namestringthe board's
$beforearraythe board's data, as the page was given it
$afterarraythe board's data now
returnsarraystring> the id each new ticket got, by the id the board gave it
throwswhen the repository refuses

viewer()

KanbanController.php:277
function viewer(): array
returnsarraystring, name?: string, avatar?: string, url?: string} who is looking: the repository's viewer, or $user
Inherited members (62)
ConstantsDeclared byDescription
ALERTiLogLevelAlert: Action must be taken immediately.
ALLiLogLevelMask for all
ALL_PLUSiLogLeveldebug everything
BACKTRACEiLogLevel
COLORSaDataControllerNamed color palettes for chart/report endpoints, e.g.
CRITICALiLogLevelCritical: Critical conditions.
DEBUGiLogLevelDebug: Detailed debug information.
DEEPiLogLeveldebug everything with arguments
EMERGENCYiLogLevelEmergency: System is unusable.
ERRORiLogLevelError: Runtime errors that do not require immediate action but should typically be logged and monitored.
ERROR_PLUSiLogLevelMask for all error
FATALiLogLevelMask for all fatal error
INFOiLogLevelInfo: Interesting events.
INFO_PLUSiLogLevelMask for all errors/warning/notices/info
MEMORYiLogLevelinclude backtrace object
NOTICEiLogLevelNotice: Normal but significant events.
NOTICE_PLUSiLogLevelMask for all errors/warning/notices/info
TRACEiLogLevelinclude backtrace as origins
WARNINGiLogLevelWarning: Exceptional occurrences that are not errors.
WARNING_PLUSiLogLevelMask for all errors and warnings
PropertiesDeclared byDescription
repositoriesaDataController
verbosityaModule
MethodsDeclared byDescription
alert($message, $context)aModuleAction must be taken immediately.
backtraces($message, $context)aModuleForce-log a message at INFO level together with a full stack trace/memory snapshot (iLogLevel::BACKTRACE), bypassing the verbosity mask entirely (any non-zero verbosity is enough to trigger it).
Configure($config)aModuleMerge $config into this module's configuration in the shared Configuration.
critical($message, $context)aModuleCritical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask.
debug($message, $context)aModuleDetailed debug information.
debugName()aModuleHuman-readable identifier used as the default {origin} in this instance's log messages.
DefaultConfig()aModuleThe config a module starts from before anything loaded via Configuration is merged in.
emergency($message, $context)aModuleSystem is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask.
error($message, $context)aModuleRuntime errors that do not require immediate action but should typically be logged and monitored.
ExtractRoutes($config)aControllerExtract all the APIRoute from this class, regardless of the fact they are registered in the application
getMainRepository()aDataController
getRepositories()aDataController
getRepository($repo)aDataController
getVerbosity()aModule
HasRoutes()aControllerTells if any APIRoute are registered in the application
info($message, $context)aModuleInteresting events. No-op if INFO is currently filtered out by the verbosity mask.
Instantiate($config)aModule(Re)create the shared instance immediately, configured with $config merged into the class's existing config.
IsShared()aModule
Link($method, $data)aControllerBuild a Link (URL + label/icon/description/title, taken from the route's APIRoute metadata) for a registered route.
log($level, $message, $context)aModuleLogs with an arbitrary level.
notice($message, $context)aModuleNormal but significant events.
offsetExists($key)aModule\ArrayAccess::offsetExists -- tells whether $key is a declared property at all, regardless of whether it is currently readable/writable through array access.
offsetGet($key)aModule\ArrayAccess::offsetGet -- reads a property directly, unless it has a #[Serialize(serialize: 'methodName')] attribute, in which case that zero-argument method is called instead (e.g.
offsetSet($key, $value)aModule\ArrayAccess::offsetSet -- sets a property directly, unless it has a #[Serialize(unserialize: 'methodName')] attribute, in which case that method is called with $value instead (e.g.
offsetUnset($key)aModule\ArrayAccess::offsetUnset -- equivalent to $module[$key] = null.
onRoute($route)aDataControllerSame as aController::onRoute, plus forcing the response to JSON (Response::Json) for every route this controller claims.
Route($method)aControllerGet a registered APIRoute WARNING: if this class was not registered in the application, it will return null.
Routes()aControllerGet a list of registered APIRoutes (from this class) in the application WARNING: if this class was not registered in the application, it will return an empty array.
serialize($path, $serializer)aModule\MMO\core\interfaces\iSerializable::serialize -- exports every property (via
setRepositories($repositories)aDataControllerRegister the repositories this controller can query, keyed by name (e.g.
setVerbosity($verb)aModuleSet the current verbosity mask, replacing whatever it was before.
Shared()aModuleGet the shared instance, creating (and configuring) it on first call.
testVerbosity($level)aModuleTest whether a given level (or set of levels) is currently enabled by this instance's verbosity mask.
traitUnshare($serialize)aModuleRemove the shared instance, so the next Shared() call creates a fresh one.
unserialize($data, $path, $instances)aModule\MMO\core\interfaces\iSerializable::unserialize -- merges $data onto DefaultConfig, runs it through the (possibly overridden) constructor, then applies each resulting value to its property (via
Unshare($serialize)aModuleLike tSingleton::Unshare, but also disconnects this module's instance from every event it was listening to (via Event::DisconnectListeners) before dropping it.
Url($method, $data)aControllerBuild the URL for a registered route, filling in any {placeholder} from $data.
warning($message, $context)aModuleExceptional occurrences that are not errors.
__construct($config)aModuleprotected constructor, so it is not possible to do new Module(...) called by the serialization process just before being injected with data.
__wakeup()aControllerCalled automatically right after the controller's shared instance is built (aModule::unserialize): registers onRoute as a Route listener with a low priority (-10), so it…