1. Go to this page and download the library: Download decole/planka-php-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
decole / planka-php-sdk example snippets
use Planka\Bridge\Config;
use Planka\Bridge\PlankaClient;
d: 'secure_password',
baseUri: 'http://192.168.1.100',
port: 3000
);
$planka = new PlankaClient($config);
$result = $planka->authenticate();
if (!$result->success) {
if ($result->t of projects
$projects = $planka->project()->list();
use Planka\Bridge\Config;
use Planka\Bridge\PlankaClient;
ort: 3000,
apiKey: 'your_user_api_key_here'
);
$planka = new PlankaClient($config);
// API Key is automatically
use Planka\Bridge\Config;
use Planka\Bridge\PlankaClient;
use Planka\Bridge\TransportClients\Client;
use Symfony\Component\HttpClient\HttpClient;
$symfonyClient = HttpClient::create([
'timeout' => 10.0,
'proxy' => 'http://proxy.corp:8080',
]);
$transport = new Client(config: $config, client: $symfonyClient);
$planka = new PlankaClient(config: $config, client: $transport);
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\HttpFactory;
use Planka\Bridge\Config;
use Planka\Bridge\PlankaClient;
use Planka\Bridge\TransportClients\PsrTransportClient;
$guzzleClient = new GuzzleClient(['timeout' => 10.0]);
$httpFactory = new HttpFactory();
$psrTransport = new PsrTransportClient(
config: $config,
httpClient: $guzzleClient, // Psr\Http\Client\ClientInterface
requestFactory: $httpFactory, // Psr\Http\Message\RequestFactoryInterface
streamFactory: $httpFactory, // Psr\Http\Message\StreamFactoryInterface
);
$planka = new PlankaClient(config: $config, client: $psrTransport);
use Planka\Bridge\Auth\TokenStorageInterface;
class CustomTokenStorage implements TokenStorageInterface
{
public function getAuthToken(): ?string { return $_SESSION['planka_jwt'] ?? null; }
public function setAuthToken(?string $authToken): void { $_SESSION['planka_jwt'] = $authToken; }
public function getApiKey(): ?string { return null; }
public function setApiKey(?string $apiKey): void {}
}
$config = new Config(
baseUri: 'http://192.168.1.100',
port: 3000,
tokenStorage: new CustomTokenStorage()
);
use Planka\Bridge\Inputs\CardPatchInput;
use Planka\Bridge\Inputs\BoardPatchInput;
// Using strongly-typed Patch Input DTO
$card = $planka->card()->patching(
cardId: '1357158568008091264',
map: new CardPatchInput(
name: 'Updated Card Title',
isClosed: true
)
);
// Or using an associative array
$board = $planka->board()->patching(
boardId: '1357158568008091265',
map: ['name' => 'Renamed Board']
);
use Planka\Bridge\Inputs\CardCreateInput;
use Planka\Bridge\Inputs\BoardCreateInput;
use Planka\Bridge\Enum\BoardDefaultCardTypeEnum;
use Planka\Bridge\Enum\BoardDefaultViewEnum;
// Option 1: Simple positional arguments (Fastest for single fields)
$card = $planka->card()->create(listId: '1357158568008091266', nameOrInput: 'Implement OAuth2');
// Option 2: Strongly-typed Creation Input DTO
$card = $planka->card()->create(
listId: '1357158568008091266',
nameOrInput: new CardCreateInput(
name: 'Implement OAuth2 Flow',
position: 1,
description: 'Detailed specification for OAuth2 flow',
type: BoardDefaultCardTypeEnum::PROJECT
)
);
// Option 3: Step-by-step Fluent Builder API
$card = $planka->card()->create(
listId: '1357158568008091266',
nameOrInput: $planka->card()->builder('Implement OAuth2 Flow')
->setPosition(1)
->setDescription('Detailed specification for OAuth2 flow')
->setType(BoardDefaultCardTypeEnum::PROJECT)
);
use Planka\Bridge\TransportClients\Middleware\PsrLoggerMiddleware;
use Planka\Bridge\TransportClients\Middleware\RetryMiddleware;
$planka = new PlankaClient(
config: $config,
middlewares: [
new PsrLoggerMiddleware($monologLogger),
new RetryMiddleware(maxRetries: 3),
]
);
use Planka\Bridge\Webhook\WebhookParser;
$parser = new WebhookParser();
$event = $parser->parse($requestJsonString);
if ($event->isCardCreated()) {
echo "Card created: {$event->card->name}\n";
}
$card = $planka->card()->get('1854744331521361455');
// Access strongly-typed DTO properties:
echo $card->name;
// Inspect the raw server payload for diagnostics:
var_dump($card->_rawResponse);