Index

ProjectBoard

MMO\git\helpers · 1 symbol · generated 5 Oct 2026

class

ProjectBoard

ProjectBoard.php:36

A GitHub project (Projects v2: github.com/users/<login>/projects/<n>, or orgs/<login>/...) seen as the data of a kanban board (mmo.client's <mmo-kanban>), and the changes made on the board written back to the project.

class MMO\git\helpers\ProjectBoard extends MMO\git\classes\aBoard
Namespace
MMO\git\helpers
Extends
aBoard
Through the GraphQL API: it needs a token that can read projects, and write them to save (README.md says which). ### What an item becomes | ticket | project item | |---------------|-------------------------------------------------------------------------------------------| | statuses | the options of the `Status` field, in the project's order | | `id` | the issue's or pull request's number; `d<n>` for a draft | | `title`, `description`, `assignee`, `labels` | the issue's, pull request's or draft's (a draft has no label) | | `status` | its `Status`; an item without one has the first | | `category` | its value of [`$categoryField`](https://mcp.mmoframework.fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-categoryfield): the project's first iteration field unless told | | `start`, `end`| its values of the date fields [`$startField`](https://mcp.mmoframework.fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-startfield) and [`$endField`](https://mcp.mmoframework.fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-endfield) | | `parent`, `constraint`, `startedAt` | a text field of the project, [`$metaField`](https://mcp.mmoframework.fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-metafield), made the first time it is needed | A status is "done" when its name says so ([`$done`](https://mcp.mmoframework.fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-done)), "not started" when it says that ([`$backlog`](https://mcp.mmoframework.fr/documentation/mmo.git/php/helpers/ProjectBoard.md#projectboard-backlog)), started otherwise. A new ticket is a draft issue of the project. A ticket removed from the board leaves the project: its issue, if it has one, stays as it is. The issues' state is not changed: the project's own workflows close an issue whose item is done, when they are set up to.
GitHubAPI::Configure(['token' => $token]); $board = ProjectBoard::FromUrl(GitHubAPI::Shared(), 'https://github.com/users/MarcMouret/projects/1'); $data = $board->load();

Constants1

FIELD_NAME

const FIELD_NAME = 'field {... on ProjectV2FieldCommon {name}}'

Properties14

api

protected MMO\git\GitHubAPI $api
Type
GitHubAPI

backlog

string $backlog = '/\\b(backlog|to ?do|new|triage|inbox|ready|planned|icebox)\\b/i'
Type
string

categoryField

?string $categoryField = null
Type
null | string

contents

protected array $contents = []
Type
array

done

string $done = '/\\b(done|closed|complete[d]?|shipped|released|finished)\\b/i'
Type
string

metaField

string $metaField = 'mmo-kanban'
Type
string

number

protected int $number
Type
int

organization

protected bool $organization
Type
bool

owner

protected string $owner
Type
string

project

protected ?array $project = null
Type
null | array

startField

?string $startField = null
Type
null | string

statusField

string $statusField = 'Status'
Type
string

users

protected array $users = []
Type
array

Methods18

categories()

ProjectBoard.php:266
protected function categories(): array
returnsarraythe board's categories: the options or iterations of the category field

discussion($ticketId)

ProjectBoard.php:284
function discussion(string $ticketId): ?MMO\git\helpers\IssueDiscussion
$ticketIdstring
returnsnull | IssueDiscussionthe comments of its issue or pull request; null for a draft, which has none
throwswhen the project cannot be read (it is, to know which repository the ticket's issue is in)

field($role)

ProjectBoard.php:245
protected function field(string $role): ?array
$rolestringstatus, category, start, end or meta
returnsnull | arraythe project's field playing that role: {id, name, dataType, options?, configuration?}

FromUrl($api, $url)

staticProjectBoard.php:83
static function FromUrl(MMO\git\GitHubAPI $api, string $url): self
$apiGitHubAPI
$urlstringthe project's page, https://github.com/users/<login>/projects/<n> or .../orgs/...
returnsself
throwswhen it is not a project's url
ProjectBoard::FromUrl(GitHubAPI::Shared(), 'https://github.com/orgs/acme/projects/3/views/1');

load()

ProjectBoard.php:109

Read the project's items as a board's data.

function load(): array
returnsarrayarray, labels: array, categories: array, tickets: array}
throwswhen GitHub refuses, or there is no such project

metaFieldOrCreate()

ProjectBoard.php:423
protected function metaFieldOrCreate(): array
returnsarraythe text field holding what the project has no field for, made the first time it is needed

project()

ProjectBoard.php:417
protected function project(): array
returnsarraythe project as last read, read now if it was not: {id, title, url, fields}
throwswhen it cannot be read

save($before, $after)

ProjectBoard.php:299

Write to the project what changed on the board: a new ticket is a draft, a removed one leaves the project.

function save(array $before, array $after): array
$beforearraythe board's data as load gave it: its tickets carry their item and content
$afterarraythe board's data now
returnsarrayarray<string, string>} the id each new ticket got (d<n>), by the id the board gave it
throwswhen GitHub refuses a change: the ones made before it are made

toFields($ticket, $statuses)

ProjectBoard.php:336
function toFields(array $ticket, array $statuses): array
$ticketarray
$statusesarraythe board's
returnsarraythe values the ticket gives its item, compared by save to know what changed

toTicket($item, $statuses)

ProjectBoard.php:208
function toTicket(array $item, array $statuses): array
$itemarrayas the GraphQL query of load gives it
$statusesarraythe board's
returnsarraythe ticket. Beyond the board's fields, it carries what saving needs: item (the item's node id), content (the draft's node id, or the issue's {repository, number}) and url

userId($login)

ProjectBoard.php:435
protected function userId(string $login): string
$loginstring
returnsstringthe user's node id, which a draft's assignees are given as

__construct($api, $owner, $number, $organization)

ProjectBoard.php:73
function __construct( MMO\git\GitHubAPI $api, string $owner, int $number, bool $organization = false )
$apiGitHubAPI
$ownerstringthe login owning the project
$numberintthe project's number, in its url
$organization = falseboolwhether the owner is an organization rather than a user
Inherited members (7)
ConstantsDeclared byDescription
COLORSaBoardthe colours mmo-kanban names, as GitHub's label colours: a colour read from GitHub is named when it is one
MethodsDeclared byDescription
ColorHex($color)aBoard
ColorName($color)aBoard
keepsColor($kind)aBoard
meta($ticket, $type)aBoard
remap($ticket, $ids, $categories)aBoardGive the board's ids of new tickets and categories the ones GitHub gave them.
remapCondition($node, $ids)aBoard