PHPackages                             juliusstoerrle/data-document-backup-core - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. juliusstoerrle/data-document-backup-core

ActiveLibrary[File &amp; Storage](/categories/file-storage)

juliusstoerrle/data-document-backup-core
========================================

Extensible PHP library to export domain data into a formatted document stored in a remote storage for backup purposes.

00PHP

Since Aug 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/juliusstoerrle/data-document-backup-core)[ Packagist](https://packagist.org/packages/juliusstoerrle/data-document-backup-core)[ RSS](/packages/juliusstoerrle-data-document-backup-core/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Data Document Backup Library
============================

[](#data-document-backup-library)

Extensible PHP library to export domain data into a formatted document for backup purposes and placed into remote storage.

It is made for use-cases where mission-critical data needs to be accessible through a secondary channel near-instantly even if the primary infrastructure has an outage.

The library is designed to be used with the Symfony Messenger, but the CreateDocument command handler can be invoked directly. Optionally, the implementation can be provided with a PSR-3 Logger.

Most document generation strategies will need to include a template from the filesystem. Please ensure the template path is not user-provided or whitelisted and your PHP installation protects which files can be accessed.

\*\* Requires temporary files \*\* Please ensure your system allows the generation of temporary files.

Get started
-----------

[](#get-started)

Include the library into your project and configure your framework / DI-container to provision the CreateDocumentHandler as service or message handler.

Use the CreateDocument command to gather all details required to generate a document.

Generating documents generally requires many dependencies, php libraries or external binaries. To reduce pollution of your vendor folder and containers, you may want to create a separate worker application, connected to the main application through a message bus.

Supported Document Generation Strategies
----------------------------------------

[](#supported-document-generation-strategies)

### Twig + Chromium

[](#twig--chromium)

Using the twig templating language to generate HTML and headless chromium to transform it into a PDF. Easiest to create good looking PDFs, but requires authoring CSS &amp; HTML. You can either provide a template file or provide a dynamic template in the TemplateReference config `template` property.

\*\* Requires installation of composer packages: `twig/twig` and `chrome-php/chrome` as well as a chromium binary within the system path. \*\* When deciding on your strategy, keep in mind that chromium (within Alpine Docker) adds 600+ MB to your image.

### Word Template: Microsoft Office Open XML (.docx)

[](#word-template-microsoft-office-open-xml-docx)

Use a MS Word document with placeholders `e.g. ${name}` to generate a MS Word document. This uses the PHPOffice/PHPWord template processing capability. At this time, only simple value replacements are possible, support for block and row cloning is planned.

This strategy does not allow for inclusion of images into the document.

In theory, other output formats are possible through PHPWord, however PDF support is very limited. PDF conversion could be accomplished through a third party tool processing incoming files at the remote storage location.

\*\* Requires installation of composer package `phpoffice/phpword` and one of 'mpdf', 'tcpdf', 'dompdf' \*\*

### Custom

[](#custom)

You may create a custom strategy by implementing the DocumentGenerator interface and providing it to the CreateDocumentHandler.

Storage
-------

[](#storage)

For each document generation, a backup target has to be defined. This includes the filename, storage type and the type-specific storage configuration.

### Local

[](#local)

Files may be stored locally

Storage Configuration:

```
[
   'root' => '/root/path/', // required
]
```

### WebDAV

[](#webdav)

Storage Configuration:

```
[
    'baseUri' => 'http://your-webdav-server.org/', // required
    'userName' => 'your_user',
    'password' => 'superSecret1234'
]
```

### FTP

[](#ftp)

Storage Configuration:

```
[
   'host' => 'hostname', // required
   'root' => '/root/path/', // required
   'username' => 'username', // required
   'password' => 'password', // required
   'port' => 21,
   'ssl' => false,
   'timeout' => 90,
   'utf8' => false,
   'passive' => true,
   'transferMode' => FTP_BINARY,
   'systemType' => null, // 'windows' or 'unix'
   'ignorePassiveAddress' => null, // true or false
   'timestampsOnUnixListingsEnabled' => false, // true or false
   'recurseManually' => true // true
]
```

### Custom

[](#custom-1)

If you need another storage system, please check the official phpleague/flysystem adapters. If an adapter exists (very likely), please create a pull request to extend the flysystem adapter in this library to allow instantiation of the adapter.

If your needs are not covered by flysystem, you can implement your own Version of BackupFilesystem and provide it to the CreateDocumentHandler.

Template Design
---------------

[](#template-design)

**Note:** Keys in the Data object of a CreateDocument command MUST NOT start with \_ (reserved for provider specific template variables).

Development
-----------

[](#development)

The library includes a Dockerfile to generate an image with all required tooling. All regular commands are aliased in the composer.json.

### Building the included docker image

[](#building-the-included-docker-image)

Note: If you want to create your own image to use the library, check the build of the worker application for inspiration

Requires writable directories for temporary files and template caching.

`docker build -t php-tools-chromium:8.3 -f Dockerfile .`

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e2c060367bc7f9596980ff6433907c878dea9043a79f132f89ae8afe2669595?d=identicon)[js-dev](/maintainers/js-dev)

### Embed Badge

![Health badge](/badges/juliusstoerrle-data-document-backup-core/health.svg)

```
[![Health](https://phpackages.com/badges/juliusstoerrle-data-document-backup-core/health.svg)](https://phpackages.com/packages/juliusstoerrle-data-document-backup-core)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M123](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M61](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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