kjgcoop/trello-label-package

Library to get Trello tasks organized by label instead of by board

dev-master 2019-07-25 22:24 UTC

This package is not auto-updated.

Last update: 2024-10-27 06:23:43 UTC


README

Trello's labels are per board, so you can't see all the tasks with a given label. Rather than hopping between boards, you can use this script to loop through the labels.

Getting Started

// Give the object enough information to connect to Trello
$batch = new TrelloLabelBatch([Trello API key], [Trello API token], [Trello user whose data you're interested in]);

// Grab the data
$batch->populate();

// You may now work with the data.

foreach ($batch->get_labels() as $label) {
    foreach ($label->get_cards() as $card) {
        // Whatever you want to do.
    }
}

The script assumes that you only want to deal in one user's boards.

Notes on Data

A populated batch represents an array of all your labels, each containing the relevant cards.

  • A TrelloLabel object has a color, a name and a list of cards
  • A TrelloCard object has a name, board name and list of labels.

Any given card may appear any number of times.

  • If a card has no labels, it won't appear in the data structure. While Trello boards have a list of its labels, this generates its list by looping through existing cards.
  • If a card has more than one label applied, the card will appear in memory once per label.

Prerequisites

PHP and the PHP Curl Extension and Composer. All the other dependencies are handled by Composer.

Built With

License

This is licensed under the GPL License