Search by

adachsoft / data-backup-http-target

Arkadiusz Adach

PSR-18 HTTP backup target for remote data backup APIs.

Package info

gitlab.com/a.adach/data-backup-http-target

Issues

pkg:composer/adachsoft/data-backup-http-target

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-11-30 22:21 UTC

This package is auto-updated.

Last update: 2026-11-30 21:22:32 UTC


README

adachsoft/data-backup-http-target provides a PSR-18 implementation of BackupTargetInterface for systems exposing the adachsoft/data-backup-symfony-bundle HTTP backup API. It lets BackupService download a remote archive and save it to a local archive storage, where the local service can apply its own retention policy.

Installation

composer require adachsoft/data-backup-http-target

Provide a PSR-18 HTTP client and PSR-17 request and stream factories from your application. No HTTP framework is required by this library.

Features

  • Implements BackupTargetInterface using a PSR-18 HTTP client.
  • Creates remote archives and exposes them as archive readers for local storage.
  • Supports configurable API endpoints, request headers, and remote storage selection.
  • Reports HTTP and response-format errors with request context.

Requirements

  • PHP 8.3 or later.
  • A PSR-18 HTTP client and PSR-17 request and stream factories.
  • A PSR-7 message implementation compatible with those interfaces.
  • adachsoft/data-backup when using the target with BackupService.

Usage with BackupService

use AdachSoft\DataBackup\Service\BackupService;
use AdachSoft\DataBackupContracts\Collection\DataSourceIdCollection;
use AdachSoft\DataBackupContracts\Dto\ExportRequest;
use AdachSoft\DataBackupContracts\ValueObject\LabelMap;
use AdachSoft\DataBackupHttpTarget\HttpBackupTarget;
use AdachSoft\DataBackupHttpTarget\HttpBackupTargetConfig;

$target = new HttpBackupTarget(
    $httpClient,
    $requestFactory,
    $streamFactory,
    $archiveFormat,
    new HttpBackupTargetConfig(
        baseUrl: 'https://task-api.example.com',
        headers: ['X-API-KEY' => $apiKey],
        remoteStorage: 'nightly',
    ),
);

$backupService = new BackupService(
    $archiveFormat,
    $streamFactory,
    $retentionPolicy,
    $eventListener,
    $clock,
);

$reference = $backupService->backup(
    $target,
    $localArchiveStorage,
    new ExportRequest(new DataSourceIdCollection(), new LabelMap(['schedule' => 'hourly'])),
);

An empty source collection requests all remote sources. The configured headers are sent with each request. When remoteStorage is set, it is included in the archive creation request and in the download URL.

Remote restoration

Import is not supported by this client. Restore an archive on the remote system using POST /api/v1/backup/import or run the data-backup:restore command there.