# myclabs/deepcopy

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/myclabs-deepcopy).**

8,891 stars · 108 forks · PHP · MIT

## Links

- GitHub: https://github.com/myclabs/DeepCopy
- awesome-repositories: https://awesome-repositories.com/repository/myclabs-deepcopy.md

## Topics

`clone` `clone-deep`

## Description

DeepCopy is a recursive object cloning library designed to create independent copies of complex nested objects. It functions as a state snapshot utility and object cloning tool that produces clones while preserving the original object graph.

The library includes a circular reference handler to duplicate data structures containing self-referencing loops without causing infinite recursion. It also serves as an object property transformer, allowing for the filtering or modification of specific fields and types during the cloning process based on custom matching criteria.

## Tags

### Data & Databases

- [Object Duplicators](https://awesome-repositories.com/f/data-databases/data-transfer-objects/object-duplicators.md) — Provides a utility for creating independent deep copies of complex objects and their nested dependencies. ([source](https://github.com/myclabs/deepcopy#readme))
- [Deep Object Manipulations](https://awesome-repositories.com/f/data-databases/object-property-accessors/deep-object-manipulations.md) — Implements recursive cloning of nested data structures while preserving the object graph to handle circular references. ([source](https://github.com/myclabs/deepcopy#readme))
- [Object Transformation](https://awesome-repositories.com/f/data-databases/ordered-data-structures/ordered-collection-literals/object-collection-processors/object-transformation.md) — Allows for cloning, picking, and omitting properties within objects using custom matching criteria.

### Programming Languages & Runtimes

- [Object Cloning Techniques](https://awesome-repositories.com/f/programming-languages-runtimes/object-cloning-techniques.md) — Implements deep copying patterns to create exact copies of nested objects without sharing references.
- [JavaScript Implementations](https://awesome-repositories.com/f/programming-languages-runtimes/object-cloning-techniques/javascript-implementations.md) — Provides a complete recursive cloning utility specifically designed for JavaScript objects.
- [Object Property Transformers](https://awesome-repositories.com/f/programming-languages-runtimes/object-property-transformers.md) — Provides the ability to filter or modify specific fields and types during the cloning process based on custom matching criteria. ([source](https://github.com/myclabs/deepcopy#readme))

### Software Engineering & Architecture

- [Cloning Traversers](https://awesome-repositories.com/f/software-engineering-architecture/custom-object-hydration/recursive-object-graph-hydration/cloning-traversers.md) — Traverses complex object trees recursively to produce independent clones while avoiding circularity loops.
- [Reference Tracking](https://awesome-repositories.com/f/software-engineering-architecture/dependency-resolution-engines/circular-reference-detection/reference-tracking.md) — Tracks object identities during the cloning process to preserve shared references and prevent infinite recursion from circular loops.
- [State Snapshots](https://awesome-repositories.com/f/software-engineering-architecture/architectural-design-patterns/state-management/persistence-and-serialization/state-serialization/state-snapshots.md) — Captures the current state of an object tree as a snapshot to prevent accidental mutations of the original data.
