PHP code example of juzim / todo-txt-parser
1. Go to this page and download the library: Download juzim/todo-txt-parser 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/ */
juzim / todo-txt-parser example snippets
Get raw string:
$task->getOriginalText() // 'x 2016-11-22 (A) 2016-01-02 Tell @me to write the @README for +todoTxtParser due:2016-09-05'
Get clean string (only readable text):
$task->getCleanText() // 'Tell @me to write the @README for +todoTxtParser'
Get metadata:
$task->isCompleted() // starts with 'x ' -> true
$task->getCompletedAt() // YYYY-MM-DD after 'x' -> DateTime/2016-11-22
$task->getPriority() // (A-Z) -> 'A'
$task->getCreatedAt() // YYYY-MM-DD -> DateTime/2016-01-02
$task->getProjects() // + -> ['todoTxtParser']
$task->getContexts() // @ -> ['me', 'README']
$task->getAddOns() // {key}:{text} -> ['due' => '2016-09-05']