myclabs/deep-copy
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The "myclabs/deep-copy" PHP package provides a means to create deep copies (clones) of your objects. Unlike a simple copy, a deep copy is a complete standalone replica of an object, including nested objects and arrays that it may contain. This package is designed with the ability to handle cycles in the association graph, effectively avoiding issues of infinite recursion during copy operations.
To use "myclabs/deep-copy" in your PHP project, you first need to install the package using Composer. This can be done with the following command:
composer require myclabs/deep-copy
Once installed, you can include the DeepCopy class in your PHP code and then use it to copy objects. Here is a basic example of how to use it:
use DeepCopy\DeepCopy;
// Create a DeepCopy instance
$copier = new DeepCopy();
// Use the copy() method to create a deep copy
$myCopy = $copier->copy($myObject);
This package offers additional functionality allowing customization of the copy process using filters and matchers. This provides control over specific property handling during the copy operation.
All instructions and detailed usage information for the "myclabs/deep-copy" package are provided within its README, located in the GitHub repository at: https://github.com/myclabs/DeepCopy.git. The comprehensive document contains examples and further details on how to customize your copying operations, information about handling edge cases, and how to contribute to the package's development.