Download the PHP package clarkewing/legacy-sync without Composer
On this page you can find all versions of the php package clarkewing/legacy-sync. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download clarkewing/legacy-sync
More information about clarkewing/legacy-sync
Files in clarkewing/legacy-sync
Package legacy-sync
Short Description Lightweight Laravel package for bi-directional database syncing between a legacy and modern app.
License MIT
Homepage https://github.com/clarkewing/legacy-sync
Informations about the package legacy-sync
Legacy Sync
Legacy Sync is a lightweight Laravel package for bi-directional database syncing between a legacy and modern app. Itβs ideal for projects maintaining both a legacy and a modern Laravel app, and ensures data consistency across both systems without friction.
π Features
- π Bi-directional database syncing between legacy and modern applications
- ποΈ Flexible table and column mapping configuration
- π§© Support for different database column names and structures
- βοΈ Customizable field defaults and exclusions
- π Shared, environment-agnostic logic β install on both apps
- π Efficient processing with lazy loading for large datasets
π§© Requirements
To use Legacy Sync, the package must be installed in both Laravel applications you wish to sync.
Legacy Sync is compatible with applications using Laravel 8 and above, and requires PHP 8.1 or above.
π¦ Installation
Legacy Sync must be installed in both your legacy app and the modern app.
Make sure you configure your database connections in your applicationβs config/database.php file:
βοΈ Configuration
Publish the config file using the following command:
This will create a config/legacy_sync.php file with the following structure:
π§ Usage
Syncing Tables
Legacy Sync provides a simple API for syncing tables between your legacy and modern applications:
Syncing Individual Records
For more granular control, you can sync individual records by their primary key:
Artisan Commands
Legacy Sync also provides an Artisan command for syncing tables:
Configuration Examples
Basic Column Mapping
When column names differ between legacy and new databases:
Setting Default Values
For columns that exist in only one database:
Excluding Columns
To exclude specific columns from syncing:
π§ͺ Testing
You can safely prevent real database syncing during tests by faking the facade. When faked, all sync methods become no-ops and no database writes will occur.
LegacySync::fake()swaps the facade to a fake implementation.LegacySync::isFake()lets you detect if the facade is currently faked.
Example (Pest):
You can also fake before invoking your own application code or Artisan commands that trigger syncing:
Note: The provided fake is intentionally a safe no-op and does not record calls for assertions. If you need to assert specific interactions, mock your own collaborators or assert application-side effects instead of database changes.
π Security
When syncing sensitive data between databases, ensure both systems have appropriate security measures in place. Consider excluding sensitive fields from syncing or implementing additional encryption as needed.
π€ Contributing
Issues and PRs welcome! Please see our Contribution guidelines if contributing tests or features.
π License
Released under the MIT License.
All versions of legacy-sync with dependencies
illuminate/console Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0