Download the PHP package iwink/tree without Composer

On this page you can find all versions of the php package iwink/tree. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tree

iWink Tree

License Tag

This component provides a Tree that can be traversed and modified.

Tree

The Node and contains methods to traverse the nodes contained in the root node:

Visitors

The tree implements the Visitor pattern. A number of common visitors are included in this component:

There are also 2 abstract visitors that provide a base implementation:

Creating your own visitor

To create your own visitor you need to let it implement VisitorInterface or extend the abstract Visitor or ArrayVisitor class.

Sometimes you need to perform some action before the visitor starts visiting or after it is done visiting. For these situations you can use beforeVisiting() and afterVisiting() methods. E.g. The ArrayVisitor always resets the internal array on beforeVisiting() to prevent result stacking on multiple calls.

Example

Building the tree

A visual representation of this tree looks like this:

Traversing the tree

Now we can traverse this tree and apply a visitor:

Serializing the tree

To persist the tree to a file or a database record, you can use TreeInterface::serialize(?callable $converter = null). This serializes the tree to a format that preserves hierarchy and can be restored. If the node's values aren't scalar, you might want to pass a $converter to this method so those values are serializable as well.

Building the tree from a serialized format

If you have a serialized tree, you can restore it using TreeInterface::fromSerialized(array $serialized, ?callable $converter = null, string $node_class = Node::class). It takes an optional $converter to restore the node's value if this isn't a scalar value. You can also pass your own implementation of a $node_class to create a tree that consists of different nodes. Just make sure your node class implements NodeInterface.


All versions of tree with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package iwink/tree contains the following files

Loading the files please wait ....