Search by

adachsoft / task-api-repository

Arkadiusz Adach

HTTP implementation of the adachsoft/task-contracts repositories backed by adachsoft/task-api.

Package info

gitlab.com/a.adach/task-api-repository

Issues

pkg:composer/adachsoft/task-api-repository

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-10-12 13:04 UTC

This package is not auto-updated.

Last update: 2026-10-13 09:32:21 UTC


README

HTTP implementation of the adachsoft/task-contracts repositories backed by adachsoft/task-api.

Installation

composer require adachsoft/task-api-repository

The service must expose the /api/v1/repository endpoints and run adachsoft/task-api version 0.6.1 or newer.

Usage

use AdachSoft\TaskApiRepository\Factory\TaskApiRepositoryFactory;

$taskRepository = TaskApiRepositoryFactory::createTaskRepository(
    'https://tasks.example.com',
    $apiKey,
);

The factory also provides createCommentRepository(). The API key is sent using the X-API-KEY header. Configuration is validated before any request is made.

Error mapping

API reasonException
task_not_foundTaskNotFoundException
comment_not_foundCommentNotFoundException
dependency_not_foundDependencyNotFoundException
dependency_already_existsDependencyAlreadyExistsException
task_already_existsTaskAlreadyExistsException
comment_already_existsCommentAlreadyExistsException
concurrent_modificationConcurrentModificationException
invalid_task_dataInvalidTaskDataException
contract_violationInvalidArgumentException

Unknown API errors and malformed responses are reported as TaskApiRepositoryException.

Optimistic locking

Repository updates use the DTO version field. A ConcurrentModificationException means that another client changed the record; read the record again before retrying an update.

Tests

The test suite runs with:

vendor/bin/phpunit tests

The controlled Docker E2E suite clones adachsoft/task-api at version v0.6.1, installs its dependencies, resets the API storage before each contract test, and starts its Docker Compose test stack automatically:

composer test:e2e-docker

The Docker E2E suite requires Git, Composer, Docker Engine, Docker Compose v2, network access to GitLab, and an available host port 8081. Missing prerequisites or an unavailable API fail the suite; no manual checkout or external API credentials are required.