public static function demo() { echo "LiquidPlanner email: "; $email = trim(fgets(STDIN)); echo "LiquidPlanner password for {$email}: "; system('stty -echo'); $password = trim(fgets(STDIN)); system('stty echo'); echo PHP_EOL; $lp = new LiquidPlanner($email, $password); $account = $lp->account(); echo "You are {$account->user_name} ({$account->id})" . PHP_EOL; $workspaces = $lp->workspaces(); $count = count($workspaces); $plural = $count == 1 ? '' : 's'; echo "You have {$count} workspace{$plural}" . PHP_EOL; foreach ($workspaces as $ws) { echo " {$ws->name}\n"; } $ws = $workspaces[0]; $lp->workspace_id = $ws->id; $projects = $lp->projects(); $count = count($projects); echo "These are the {$count} projects in your '{$ws->name}' workspace" . PHP_EOL; foreach ($projects as $i => $p) { echo ' ' . ($i + 1) . '. ' . $p->name . PHP_EOL; } echo "Should I add a task to your first project? (y for yes) "; $add_task = fgets(STDIN); if ('Y' == strtoupper(substr(trim($add_task), 0, 1))) { $task = array('name' => 'learn the API', 'parent_id' => $projects[0]->id); $result = $lp->create_task($task); $update = array('name' => 'learn more about the API', 'id' => $result->id); print_r($lp->update_task($update)); } }