Download the PHP package cpsit/migrator without Composer
On this page you can find all versions of the php package cpsit/migrator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cpsit/migrator
More information about cpsit/migrator
Files in cpsit/migrator
Package migrator
Short Description Composer package for migrating files with a calculated diff
License GPL-3.0-or-later
Informations about the package migrator
A PHP library to perform migrations of files with a calculated diff between two
code bases using three-way merge. Uses the cypresslab/gitelephant
package
for any Git operations and provides an interface for custom differ implementations.
🚀 Features
- Automatic file content migration
- Various implementations for source and target code base
- Interface for custom differ implementations
🔥 Installation
⚡ Usage
Command-line
Available options:
--dry-run
does not perform migrations, but only calculates and shows diff between code bases--verbose
shows the calculated diff (implicitly enabled with--dry-run
)
PHP
🎢 Architecture
Lifecycle
In order to generate a diff between two code bases, you must provide two collections of resources. This, for example, can be a directory with template files of a previous revision compared to a directory with template files of a current revision. Additionally, you must provide a base directory containing all files to be migrated.
The migration is calculated by a differ. It will generate and apply a diff between both code bases and the provided base files using the three-way merge strategy.
Resource
All relevant code bases (source and target) must be represented by a
Resource\Collector\CollectorInterface
.
The following implementations are currently available:
ArrayCollector
holds all relevant resources in a plain array.CallbackCollector
provides all relevant resources through a configured callback function.ChainedCollector
holds multiple collectors that are called one after the other.DirectoryCollector
provides all relevant resources within a configured base directory.FileCollector
provides a single file as resource collection.
Differ
Diffs are calculated by an implementation of
Diff\Differ\Differ
. The
following implementations are currently available:
GitDiffer
uses the native Git binary to create diffs. This is done by the great librarycypresslab/gitelephant
.
Formatter
Formatters can be used to properly display a calculated
Diff\DiffResult
. Each formatter implements
Formatter\Formatter
. The following implementations
are currently available:
CliFormatter
is used on command line. It displays the calculated diff with ANSI colors, targeting Symfony's console output.TextFormatter
can be used in other contexts than command line, e.g. to properly display the calculated diff in case ANSI colors are not available.
🧑💻 Contributing
Please have a look at CONTRIBUTING.md
.
⭐ License
This project is licensed under GNU General Public License 3.0 (or later).
All versions of migrator with dependencies
cypresslab/gitelephant Version ^4.5
symfony/console Version ^5.4 || ^6.0 || ^7.0
symfony/filesystem Version ^5.4 || ^6.0 || ^7.0
symfony/finder Version ^5.4 || ^6.0 || ^7.0