Download the PHP package anfischer/cloner without Composer
On this page you can find all versions of the php package anfischer/cloner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download anfischer/cloner
More information about anfischer/cloner
Files in anfischer/cloner
Package cloner
Short Description A package which allows for easy recursive cloning and persistence of Laravel Eloquent models
License MIT
Homepage https://github.com/anfischer/cloner
Informations about the package cloner
Recursive cloning and persistence of Laravel Eloquent models
A package which allows for easy recursive cloning and persistence of Laravel Eloquent models, including:
- Recursive cloning of Eloquent models and their relationships without forced persistence, allowing for in-memory changes to cloned models before they are saved to the database
- Persistence of recursive relationships including cloned pivot data
Since this is a feature I commonly rely on in client projects, I decided to extract the functionality into a package. However this also has the consequence that your mileage may vary, and hence pull requests are welcome - please see CONTRIBUTING for details.
Structure
Version Compatibility
Laravel | Cloner | PHP |
---|---|---|
5.4.x | 0.1.0 | ^5.4 |
6.x | 0.2.0 | ^7.3 |
7.x | 0.2.0 | ^7.3 |
8.x | 0.2.0 | ^7.3 |
9.x | 0.4.0 | ^8.0.2 |
Install
Via Composer
The package will automatically register its service provider.
Usage
Basic Usage
Convenience Methods
Cloner also exposes a convinience method for cloning and persisting at the same time:
Cloned Model Map
You may wish to keep track of which models were cloned and the keys of their respective clones. In order to do this Cloner keeps a record of these keys.
Configuration
To publish the config file to config/cloner.php run:
Cloner supports various persistence strategies by default. These can be configured
by modifying the configuration in config/cloner.php
.
For example
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Andreas Fischer
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of cloner with dependencies
illuminate/database Version ^6.0|^7.0|^8.0|^9.0
illuminate/support Version ^6.0|^7.0|^8.0|^9.0
laravel/legacy-factories Version ^1.0