PHPackages                             lukascivil/treewalker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. lukascivil/treewalker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lukascivil/treewalker
=====================

TreeWalker is a simple and small Library that will help you to work faster with manipulation of structures in PHP

v1.0.0(2mo ago)741.1M—2.3%287MITPHPPHP &gt;=8.1CI failing

Since Jul 11Pushed 2mo ago9 watchersCompare

[ Source](https://github.com/lukascivil/TreeWalker)[ Packagist](https://packagist.org/packages/lukascivil/treewalker)[ RSS](/packages/lukascivil-treewalker/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (3)Versions (11)Used By (7)

TreeWalker
==========

[](#treewalker)

A simple and lightweight PHP library for manipulating nested structures — arrays, objects and JSON strings interchangeably.

![Build Status](https://github.com/lukascivil/TreeWalker/workflows/PHP%20Composer/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/99afff3c34f43f14f2daee2ea704e255ba0a196e45fe53a7d9f1372f8e93f089/68747470733a2f2f706f7365722e707567782e6f72672f6c756b6173636976696c2f7472656577616c6b65722f646f776e6c6f616473)](https://packagist.org/packages/lukascivil/treewalker)[![codecov](https://camo.githubusercontent.com/e30ab374b032e20a5c70ab9ff1b736d03de41997f37b10903fb99de089e3d1d8/68747470733a2f2f636f6465636f762e696f2f67682f6c756b6173636976696c2f5472656557616c6b65722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/lukascivil/TreeWalker)[![License](https://camo.githubusercontent.com/74ee8e5c997eb3b2a399375ad75c80a168f708db7b6d55ed0447df7b54fcfeee/68747470733a2f2f706f7365722e707567782e6f72672f6c756b6173636976696c2f7472656577616c6b65722f6c6963656e73652e737667)](https://packagist.org/packages/lukascivil/treewalker)

Methods
-------

[](#methods)

MethodDescription`getdiff()`Returns the difference between two structures`walker()`Walks recursively through a structure, allowing edits and deletions`structMerge()`Merges two structures (first argument takes precedence)`createDynamicallyObjects()`Creates nested keys dynamically`getDynamicallyValue()`Reads a value by dynamic key path`setDynamicallyValue()`Sets a value by dynamic key path### [Live example](http://treewalker.lukascivil.com.br/)

[](#live-example)

All methods accept and return any of the three supported structure types:

```
"jsonstring" | "object" | "array"

```

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1

Installation
------------

[](#installation)

```
composer require lukascivil/treewalker
```

Usage
-----

[](#usage)

### Initialization

[](#initialization)

```
