PHPackages                             juzim/todo-txt-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. juzim/todo-txt-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

juzim/todo-txt-parser
=====================

A todo.txt parsing and validation library for PHP

0.1.0(9y ago)439MITPHPPHP &gt;=5.3.0

Since Oct 20Pushed 2y ago2 watchersCompare

[ Source](https://github.com/juzim/todo-txt-parser)[ Packagist](https://packagist.org/packages/juzim/todo-txt-parser)[ Docs](https://github.com/juzim/todo-txt-parser)[ RSS](/packages/juzim-todo-txt-parser/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Todo.Txt Parser
===============

[](#todotxt-parser)

### A [todo.txt](http://todotxt.com) parsing and validation library for PHP

[](#a-todotxt-parsing-and-validation-library-for-php)

**Installation**

`$ composer require "juzim/todo-txt-parser:~1.0"`

**Usage**

```
$parser = new TodoTxtParser();
$task = $parser->buildTaskFromString('x 2016-11-22 2016-11-20 (A) due:2016-09-05 Tell @me to write the @README for +todoTxtParser');

```

This will return a TodoTxtTask object that includes all values ([see todo.txt rules](https://github.com/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format)):

```
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']

```

The following errors get collected:

```
ERROR_NO_TEXT_GIVEN                     -> No text given
ERROR_NO_TASK_DESCRIPTION               -> Task is missing a description/only has metadata
ERROR_INVALID_DATE_CREATED_AT           -> Invalid created at date
ERROR_INVALID_DATE_COMPLETED_AT         -> Invalid completed at date
ERROR_COMPLETED_AT_MISSING              -> Task is completed but has no completed at date
ERROR_CREATED_AT_IN_THE_FUTURE          -> Created at date is in the future
ERROR_COMPLETED_AT_IN_THE_FUTURE        -> Completed at date is in the future
ERROR_DUPLICATE_ADD_ON_KEY              -> Duplicate add-on key
ERROR_COMPLETED_AT_BEFORE_CREATED_AT    -> Task was completed before it was created

```

If at least one of those errors occurred, a `TodoTxtValidationException` is thrown at the end which includes all collected errors in readable format. Specific errors can be ignored with $parser-&gt;ignoreError(TodoTxtParser::ERROR\_NAME).

**Notes**

- Metadata that doesn't match one of the rules becomes part of the description
- Leading/trailing whitespace and duplicate spaces get removed
- Add-Ons are not part of the clean text (not sure if that's correct thou)
- Anything goes for the description text, so remember to filter/escape accordingly
- For now there are no rules for projects, contexts and add-ons other then the regex, but some restrictions like valid characters or length might be added later on

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3541d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f449a72d9b463bff78e6fe9615fa9105093217cc5ce538879c6434c3ebc46a88?d=identicon)[juzim](/maintainers/juzim)

---

Top Contributors

[![juli-dot-md](https://avatars.githubusercontent.com/u/4820796?v=4)](https://github.com/juli-dot-md "juli-dot-md (1 commits)")

---

Tags

todotodo.txt

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/juzim-todo-txt-parser/health.svg)

```
[![Health](https://phpackages.com/badges/juzim-todo-txt-parser/health.svg)](https://phpackages.com/packages/juzim-todo-txt-parser)
```

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19037.7M41](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9642.0k](/packages/sauladam-shipment-tracker)[moonshine/layouts-field

Field for repeating groups of fields for MoonShine

107.9k](/packages/moonshine-layouts-field)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

112.9k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
