2017 © Pedro Peláez
 

library taskwarrior

a php lib for taskwarrior

image

davidbadura/taskwarrior

a php lib for taskwarrior

  • Wednesday, July 13, 2016
  • by DavidBadura
  • Repository
  • 2 Watchers
  • 12 Stars
  • 183 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 6 Open issues
  • 21 Versions
  • 1 % Grown

The README.md

Taskwarrior PHP lib

used by doThings - a Taskwarrior web-ui., (*1)

Build Status, (*2)

WOW, (*3)

Install

composer require 'davidbadura/taskwarrior'

Unfortunately, the annotation reader is not automatically registered on composer. So you should add following line if you have [Semantical Error] The annotation "@JMS\Serializer\Annotation\Type" in property [...] does not exist, or could not be auto-loaded. exception:, (*4)

\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader('class_exists');

Requirements

Taskwarrior changes its behavior by patch level updates and it is very difficult to support all versions. The current supported versions are:, (*5)

PHP Lib Taskwarrior PHP Version
2.x >=2.4.3 >=5.4
3.x >=2.5.0 >=5.5

Usage

use DavidBadura\Taskwarrior\TaskManager;
use DavidBadura\Taskwarrior\Task;
use DavidBadura\Taskwarrior\Recurring;
use DavidBadura\Taskwarrior\Annotation;

$tm = TaskManager::create();

$task = new Task();
$task->setDescription('program this lib');
$task->setProject('hobby');
$task->setDue('tomorrow');
$task->setPriority(Task::PRIORITY_HIGH);
$task->addTag('next');
$task->setRecurring(Recurring::DAILY);
$task->addAnnotation(new Annotation("and add many features"));

$tm->save($task);

$tasks = $tm->filterPending('project:hobby'); // one task

$tm->done($task);

$tasks = $tm->filterPending('project:hobby'); // empty
$tasks = $tm->filter('project:hobby'); // one task

$tasks = $tm->filterByReport('waiting'); // and sorting

API

Task

attr writeable type
uuid false string
description true string
priority true string
project true string
due true DateTime
wait true DateTime
tags true string[]
annotations true Annotation[]
urgency false float
entry false DateTime
start false DateTime
recur true Recurring
unti true DateTime
modified false DateTime
end false DateTime
status false string

Example:, (*6)

$task = new Task();
$task->setDescription('program this lib');
$task->setProject('hobby');
$task->setDue('tomorrow');
$task->setPriority(Task::PRIORITY_HIGH);
$task->addTag('next');
$task->setRecurring(Recurring::DAILY);

Taskwarrior

create TaskManager:, (*7)

$tm = TaskManager::create();

save a task:, (*8)

$task = new Task();
$task->setDescription('foo');
$tm->save($task);

find a task:, (*9)

$task = $tm->find('b1d46c75-63cc-4753-a20f-a0b376f1ead0');

filter tasks:, (*10)

$tasks = $tm->filter('status:pending');
$tasks = $tm->filter('status:pending +home');
$tasks = $tm->filter('status:pending and +home');
$tasks = $tm->filter(['status:pending', '+home']);

filter pending tasks:, (*11)

$tasks = $tm->filterPending('+home');
$tasks = $tm->filterPending('project:hobby +home');
$tasks = $tm->filterPending('project:hobby and +home');
$tasks = $tm->filterPending(['project:hobby', '+home']);

count tasks:, (*12)

$tasks = $tm->count('status:pending');
$tasks = $tm->count('status:pending +home');
$tasks = $tm->count('status:pending and +home');
$tasks = $tm->count(['status:pending', '+home']);

delete task:, (*13)

$tm->delete($task);

done task:, (*14)

$tm->done($task);

start task:, (*15)

$tm->start($task);

stop task:, (*16)

$tm->stop($task);

reopen task:, (*17)

$tm->reopen($task);

dependencies:, (*18)

$task1 = new Task();
$task1->setDescription('a');

$task2 = new Task();
$task2->setDescription('b');

$task1->addDependency($task2);

// the order is important!
$tm->save($task2);
$tm->save($task1);

$tm->clear(); // clear object cache

$task1 = $tm->find('uuid-from-task1');
$task2 = $task1->getDependencies()[0];
echo $task2->getDesciption(); // "b" <- lazy loading

annotations:, (*19)

$task = new Task();
$task->setDescription('a');
$task->addAnnotation(new Annotation("foobar"));

$tm->save($task);

$tm->clear(); // clear object cache

$task = $tm->find('uuid-from-task1');
$annotation = $task->getAnnotations()[0];
echo $annotation->getDesciption(); // "foobar"

QueryBuilder

example:, (*20)

$tasks = $taskManager->createQueryBuilder()
    ->whereProject('hobby')
    ->orderBy(['entry' => 'DESC'])
    ->getResult()

The Versions

28/06 2015

2.0.2

2.0.2.0

a php lib for taskwarrior

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Badura

task taskwarrior

28/06 2015

dev-improve-tests

dev-improve-tests

a php lib for taskwarrior

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Badura

task taskwarrior

28/06 2015

2.0.1

2.0.1.0

a php lib for taskwarrior

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Badura

task taskwarrior

15/05 2015

2.0.0

2.0.0.0

a php lib for taskwarrior

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Badura

task taskwarrior

15/05 2015

2.0.0-alpha

2.0.0.0-alpha

a php lib for taskwarrior

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Badura

task taskwarrior

23/04 2015

1.2.x-dev

1.2.9999999.9999999-dev

a php lib for taskwarrior

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Badura

task taskwarrior

23/04 2015

1.2.0

1.2.0.0

a php lib for taskwarrior

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Badura

task taskwarrior

04/04 2015

1.1.3

1.1.3.0

a php lib for taskwarrior

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Badura

task taskwarrior

03/04 2015

1.1.2

1.1.2.0

a php lib for taskwarrior

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Badura

task taskwarrior

03/04 2015

1.1.1

1.1.1.0

a php lib for taskwarrior

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Badura

task taskwarrior

10/02 2015

1.1.0

1.1.0.0

a php lib for taskwarrior

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Badura

task taskwarrior

08/02 2015

1.0.0

1.0.0.0

a php lib for taskwarrior

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Badura

task taskwarrior