A simple PHP CLI for managing a task list, with CSV file storage. Built as a PHP learning project — covers OOP, file handling, CLI argument parsing, error handling, and containerization with Docker.
- Load task list from a CSV file
- Add a new task via CLI argument
- Filter tasks by status
- Save results back to the file
- Readable error messages for invalid arguments
php-task-cli/
├── composer.json
├── Dockerfile
├── docker-compose.yml
├── src/
│ ├── Task.php
│ └── TaskRepository.php
└── bin/
└── console.php
- PHP >= 8.1
- Composer
Alternatively: Docker + Docker Compose (see below).
git clone https://github.com/your-username/php-task-cli.git
cd php-task-cli
composer installphp bin/console.php list [--status=STATUS]
php bin/console.php add "Task title" [--status=STATUS]
php bin/console.php helpAdd a task:
php bin/console.php add "Learn PHP" --status=todoDodano zadanie [1] Learn PHP (todo)
List all tasks:
php bin/console.php listList tasks with a specific status:
php bin/console.php list --status=todoData is stored in data/tasks.csv.
The project ships with a ready-to-use Dockerfile and docker-compose.yml — no local PHP or Composer installation required.
Build the image:
docker compose buildRun commands:
docker compose run --rm cli add "Task from Docker" --status=todo
docker compose run --rm cli listThe data/ folder is mounted as a volume, so tasks.csv persists on your machine even though each container is disposable (--rm).
The program exits with code 0 on success and 1 on error (e.g. missing task title, unknown command), printing a readable message to STDERR.
MIT