Search by

adachsoft / task-json-file

Arkadiusz Adach

JSON file implementation of adachsoft/task-contracts

Package info

gitlab.com/a.adach/task-json-file

Issues

pkg:composer/adachsoft/task-json-file

Statistics

Installs: 39

Dependents: 0

Suggesters: 0

Stars: 0

v0.2.0 2026-10-07 05:41 UTC

This package is not auto-updated.

Last update: 2026-10-21 03:48:05 UTC


README

A JSON file implementation of the adachsoft/task-contracts repository interfaces.

Features

  • Persist tasks and comments in JSON files.
  • Add, update, delete, and find tasks and comments by identifier.
  • Allocate the next task or comment identity.
  • Build task trees.
  • Manage task dependencies.
  • Count children and comments for multiple tasks.
  • Protect read-modify-write operations with exclusive file locking.
  • Detect concurrent updates with optimistic version checks.

Installation

composer require adachsoft/task-json-file

Usage

<?php

declare(strict_types=1);

use AdachSoft\TaskJsonFile\Repository\JsonTaskRepository;

$repository = new JsonTaskRepository(__DIR__ . '/var/tasks.json');

$task = $repository->findById('task1');
$rootTasks = $repository->findByParentId(null);

The repository implements AdachSoft\TaskContracts\Interface\TaskRepositoryInterface and stores data in the JSON file path provided to the constructor. Use add() for inserts and save() for compare-and-swap updates; persisted entities are versioned starting at version 1.

Use AdachSoft\TaskJsonFile\Repository\JsonCommentRepository to persist and query comments associated with tasks. Both repositories perform mutations atomically while holding an exclusive lock on the JSON file.

See docs/examples/ for complete usage examples.

Requirements

  • PHP 8.3 or newer
  • adachsoft/task-contracts

License

This project is released under the MIT License.