PHPackages                             vend/doxport - 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. [Database &amp; ORM](/categories/database)
4. /
5. vend/doxport

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

vend/doxport
============

Doctrine relational walk export/delete tool

2.0.6(11y ago)686.8kGPL3PHPPHP &gt;=5.4.0

Since Jun 16Pushed 11y ago22 watchersCompare

[ Source](https://github.com/vend/doxport)[ Packagist](https://packagist.org/packages/vend/doxport)[ RSS](/packages/vend-doxport/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (9)Versions (15)Used By (0)

Doxport
=======

[](#doxport)

Doxport is a library to mix Doctrine and a bit of graph theory to get stuff done. Specifically, it aims to give you powerful **exporting and archiving tools for a relational Doctrine2 schema**.

Doxport uses Doctrine 2.4, [Clue/Graph](https://github.com/clue/graph), and Symfony components. It's PHP 5.4+ and, at this stage, probably a bit MySQL-specific (although the guts should be solid).

Given a relational schema, usually via class annotations, Doxport should let you safely **archive, delete or import partial data from related tables**, in the correct order.

[![Build Status](https://camo.githubusercontent.com/8c35fc8176fe53ec892da883387fcbe39cbbeb61318a1938153539d60e83adac/68747470733a2f2f7472617669732d63692e6f72672f76656e642f646f78706f72742e706e67)](https://travis-ci.org/vend/doxport)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/c5b730f56ee2e87bc09b4bdd5eb63379a86d7dcf4dbb3195ef043fbc0227fd00/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f76656e642f646f78706f72742f6261646765732f7175616c6974792d73636f72652e706e673f733d62616262633630356163666238316630636631343162393366613134663262316262303561333631)](https://scrutinizer-ci.com/g/vend/doxport/)[![Code Coverage](https://camo.githubusercontent.com/4a1221afe6d9d970468f68b6a1c2c2f5e126f10df7d4d48e0498ea248a23a202/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f76656e642f646f78706f72742f6261646765732f636f7665726167652e706e673f733d62313962623964303436396133666330316430383934613362326637646333353232313736626463)](https://scrutinizer-ci.com/g/vend/doxport/)[![Latest Stable Version](https://camo.githubusercontent.com/c02a4bb4509cad0b47d3db5396682d28b9a39069fb47bc6d0ffa8d5bc81284e0/68747470733a2f2f706f7365722e707567782e6f72672f76656e642f646f78706f72742f762f737461626c652e737667)](https://packagist.org/packages/vend/doxport)[![License](https://camo.githubusercontent.com/d4090fcff06e7b20f2d5c18f2c657f1788e5100e767bbf0554dcbb3161ff060b/68747470733a2f2f706f7365722e707567782e6f72672f76656e642f646f78706f72742f6c6963656e73652e737667)](https://packagist.org/packages/vend/doxport)

Installation
------------

[](#installation)

Doxport is installed via Composer. The package name is `vend/doxport`.

Actions
-------

[](#actions)

### Delete

[](#delete)

The delete action removes rows from the database, and saves their content to the output directory. If the **eio** extension is loaded, these files will be sync'd at the point the entity manager is flushed and the rows actually removed.

### Export

[](#export)

Like the delete action, the export action saves row content to the output directory. However, it does not remove rows from the database. This means you won't be able to immediate import a set of exported data into the same database, because you'll get primary key errors. However, you can import into a fresh database, and this action is very useful for taking backups without disturbing the original data.

### Import

[](#import)

The import action takes a path to a previously output set for data (usually from the export or delete actions). By reading the dumped constraint information, Doxport figures out the correct order to import the data, and does so.

Algorithm
---------

[](#algorithm)

Doxport uses a bit of graph theory, so you might want to read up on these before jumping in:

- [Directed acyclic graphs](http://en.wikipedia.org/wiki/Directed_acyclic_graph): DAGs for short
- [Topological sorting](http://en.wikipedia.org/wiki/Topological_sorting): basically, produces a dependency-safe order to walk the nodes of a DAG

### Outline

[](#outline)

To start with, you tell Doxport the *root entity type*, and give it some criteria to apply to this type. For example, you might say the root entity is `My\Namespace\User`, and the criteria is `id == `.

Then, Doxport will:

1. Create a DAG with all tables in the database as the nodes, and all associations between them as the edges
2. Filter the edges to only consider 'constraining associations'
    - Usually this means only associations that actually own the foreign key, and have a foreign key constraint
3. Filter the nodes to only consider tables still associated with the root entity after the edge filtering
    - This step removes irrelevant tables. For example, only tables associated with the user type (via any number of relations)
4. Produce a topological sort of this DAG
5. For each node, in the order of the topological sort, find the shortest path back to the root entity, using a slightly different filtered DAG
    - The filtering is slightly different for this DAG because we additionally only consider edges that are 'covered' by an index

Each time step 5 occurs, an action is invoked on the resulting query. This might be `export` or `delete`, for example.

Configuration
-------------

[](#configuration)

Doxport follows a similar configuration approach to Doctrine2 (when installed as a composer project; Symfony2 does this set up for you). You're expected to create a file named `cli-config.php` or `config/cli-config.php`. This PHP file should return a `HelperSet`, which can be produced from an `EntityManager` via Doctrine2's `ConsoleRunner`:

```
return ConsoleRunner::createHelperSet($entityManager);
```

See [Doctrine2's configuration and installation](http://docs.doctrine-project.org/en/latest/reference/configuration.html)guide, and particularly the chapter on CLI tool setup, for more information.

Once you've done that, Doxport runs as a Composer bin script:

```
$ ./bin/doxport help
Doxport relational data tool version 0.0.1

Usage:
  [options] command [arguments]

Options:
  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  --version        -V Display this application version.
  --ansi              Force ANSI output.
  --no-ansi           Disable ANSI output.
  --no-interaction -n Do not ask any interactive question.

Available commands:
  delete   Deletes a set of data from the database
  export   Exports a set of data from the database
  help     Displays help for a command
  import   Imports a set of exported data into the database
  list     Lists commands

```

### Excluding Associations

[](#excluding-associations)

Sometimes, you may want to exclude a relation or entity type from being considered for Doxport operations. You can do this using annotations. All these annotations are in the `Doxport\Annotation` namespace.

NameTypeUse`Shared`EntityTo exclude an entity completely, as if the entity is shared, and shouldn't be considered owned by any relation that links to it.`Exclude`PropertyTo exclude a single relation from consideration. Useful for breaking cycles in the constraint graph, where entity A relates to B *and* B relates back to A via a different relation.`Clear`PropertyBefore a delete operation, these columns will be set to null on the entity, and that change persisted. The existing values will be written to the output directory. After an import operation, these saved values will be updated back onto the entity.To use these annotations, you'll first need to register the annotation namespace with the registry. You can do that like this:

```
AnnotationRegistry::registerAutoloadNamespaces([
    'Doxport\Annotation' => 'path/to/Doxport'
]);
```

The path to use is the relative path to the root Doxport namespace. If you don't know where this is, you can use a Composer autoloader instance to help find it.

```
$loader = require 'vendor/autoload.php'; # Composer autoloader

AnnotationRegistry::registerAutoloadNamespaces([
    'Doxport\Annotation' => $loader->getPrefixes()['Doxport\\'][0]
]);
```

Output
------

[](#output)

### Directory

[](#directory)

By default, the output directory is is `build//_`. You can change the location of the output with the `--data-dir` option.

### Files

[](#files)

Within the output directory, you'll find a file for each entity type. There are also a few additional files:

- constraints.png: A graphviz image of the constraint graph, useful for debugging the produced DAG
- constraints.txt: The topological order the entities were dumped in (one entity type per line). Used (in reverse) to decide the order to import.

### Format

[](#format)

By default, Doxport will output to JSON format. This can be changing using the `--format` option. The JSON format is an array of objects.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~23 days

Recently: every ~61 days

Total

14

Last Release

4099d ago

Major Versions

1.1.1 → 2.0.0-alpha2014-07-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/fe0e32939757c85ef7a924309394e302896dbb32e18ac2f4b9b0b1c4793b8339?d=identicon)[edsrzf](/maintainers/edsrzf)

---

Top Contributors

[![dominics](https://avatars.githubusercontent.com/u/97427?v=4)](https://github.com/dominics "dominics (2 commits)")

---

Tags

exportdoctrine2

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/vend-doxport/health.svg)

```
[![Health](https://phpackages.com/badges/vend-doxport/health.svg)](https://phpackages.com/packages/vend-doxport)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M736](/packages/sylius-sylius)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21866.0M1.7k](/packages/drupal-core)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)

PHPackages © 2026

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