Skip to content

Quickstart

Example: read organization, create project, list boards, create ticket, add comment.

<?php

require __DIR__ . '/vendor/autoload.php';

use Newfoundcodes\Okatana\Model\Project;
use Newfoundcodes\Okatana\Model\Ticket;
use Newfoundcodes\Okatana\OkatanaClient;
use Newfoundcodes\Okatana\Request\CreateProjectRequest;
use Newfoundcodes\Okatana\Request\CreateTicketRequest;
use Newfoundcodes\Okatana\Request\TicketCommentRequest;
use Newfoundcodes\Okatana\TicketPriority;

$client = OkatanaClient::create($_ENV['OKATANA_URL'], $_ENV['OKATANA_TOKEN']);
$orgId = $_ENV['OKATANA_ORG'];

$organization = $client->organizations()->get($orgId)->data();

$projectResponse = $client->projects()->create($orgId, new CreateProjectRequest(
    name: 'Payments Platform',
    key: 'PAY',
    description: 'Operational and engineering work for payments.',
));
$project = Project::fromResponse($projectResponse);

$boards = $client->boards()->list((string) $project->id)->collection();

$ticketResponse = $client->tickets()->create((string) $project->id, new CreateTicketRequest(
    title: 'Create production deployment runbook',
    boardSlug: 'open',
    descriptionHtml: '<p>Document deployment, rollback, and validation.</p>',
    priority: TicketPriority::High,
));
$ticket = Ticket::fromResponse($ticketResponse);

$client->tickets()->comment((string) $ticket->id, new TicketCommentRequest(
    '<p>Created from the PHP integration.</p>'
));

Board slugs

The create-ticket endpoint accepts board_id or board_slug. Use a project-local slug to avoid a lookup during writes. To move tickets, store board IDs from the list endpoint.

Request formats

Write methods accept request objects or associative arrays:

$client->tickets()->create($projectId, [
    'title' => 'Raw payload example',
    'board_slug' => 'open',
    'priority' => 'normal',
]);

Request objects provide IDE completion and validation. Arrays support passthrough data and unmapped API fields.