DeepCopy helps you create deep copies (clones) of your objects. It is designed to handle cycles in the association graph. How do you create deep copies of your objects (i.e. copying also all the objects referenced in the properties)? You use __clone() and implement the behavior yourself. DeepCopy recursively traverses all the object's properties and clones them. To avoid cloning the same object twice it keeps a hash map of all instances and thus preserves the object graph. Alternatively, you can create your own DeepCopy instance to configure it differently. You may want to roll your own deep copy function. You can add filters to customize the copy process. DeepCopy\Matcher applies on a object attribute. DeepCopy\TypeMatcher applies on any element found in graph, including array elements. The PropertyNameMatcher will match a property by its name.

Features

  • Implement your own cloning method
  • Use a filter with a type matcher
  • Roll your own deep copy function
  • Add filters to customize the copy process
  • Provides some generic filters and matchers

Project Samples

Project Activity

See All Activity >

Categories

Object Oriented

License

MIT License

Follow DeepCopy

DeepCopy Web Site

You Might Also Like
Gen AI apps are built with MongoDB Atlas Icon
Gen AI apps are built with MongoDB Atlas

The database for AI-powered applications.

MongoDB Atlas is the developer-friendly database used to build, scale, and run gen AI and LLM-powered apps—without needing a separate vector database. Atlas offers built-in vector search, global availability across 115+ regions, and flexible document modeling. Start building AI apps faster, all in one place.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of DeepCopy!

Additional Project Details

Programming Language

PHP

Related Categories

PHP Object Oriented Software

Registered

2021-07-19