PHP code example of virgiliopontes / trello-api

1. Go to this page and download the library: Download virgiliopontes/trello-api 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/ */

    

virgiliopontes / trello-api example snippets


$key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';


$trelloBoard = new Trello\User($key, $token);
$boardId = 'xxxxxxxxxxxxxxxxxxxxxxxx';

// Getting board info
$return = $trelloBoard->get($boardId);

// Getting list of members from board
$return = $trelloBoard->get($boardId, 'members');

// Getting list of cards from board
$arguments = array(
    'fields' => 'id,name,idList'
);
$return = $trelloBoard->get($boardId, 'cards', $arguments);


$trelloBoard = new Trello\Board($key, $token);
$boardId = 'xxxxxxxxxxxxxxxxxxxxxxxx';

// Getting board info
$return = $trelloBoard->get($boardId);

// Getting list of members from board
$return = $trelloBoard->get($boardId, 'members');

// Getting list of cards from board
$arguments = array(
    'fields' => 'id,name,idList'
);
$return = $trelloBoard->get($boardId, 'cards', $arguments);

$trelloCard = new Trello\Card($key, $token);
$cardId = 'xxxxxxxxxxxxxxxxxxxxxxxx';

// Getting Card Info
$return = $trelloCard->get($cardId);

// Getting Card Actions
$return = $trelloCard->get($cardId, 'actions');

// Creating a Card
$data = array(
    'name' => 'Test card',
    'desc' => 'This is a test card',
    'due' => null,
    'idList' => 'xxxxxxxxxxxxxxxxxxxxxxxx',
    'urlSource' => null
);
$return = $trelloCard->post($data);