Tree 2.0 released
A few days ago, I released version 2.0 of bluem/tree
, a PHP library for handling data that is structured hierarchically using parent ID references. Notable additions include:
- Added method
Tree::rebuildWithData()
to rebuild the tree with new data. Tree
andTree\Node
implementJsonSerializable
with a sensible default implementation, which means that you can easily serialize the whole tree oder nodes to JSON.- The tree data no longer has to be an array, but instead it must be an
iterable
, which means that you can either pass in an array or an object implementing theTraversable
interface. Similarly, the data for a node no longer has to be an array, but can also be an object implementing theIterator
interface. These changes should make working with the library more flexible.
As a few deprecated methods were removed and the minimum PHP version raised to 7.0, this version is not backward compatible – hence the major version number change.