Download the PHP package dc-ag/tree-nodes without Composer

On this page you can find all versions of the php package dc-ag/tree-nodes. 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-nodes

Small library for a basic but very flexible tree data structure. You have the possibility to sort tree nodes and control the payload type within the tree nodes.

Overview

The interface TreeNodes\TreeNode) and a payload (can be a simple integer or boolean or a complex object). We offer different kind of tree nodes. Choose one which fits your use-case the best.

Tree Node types

For each type a generic implementation class exists, e.g. TreeNodes\TreeNode.

Install

Best way to get started is to use Composer.

composer require dynamic-commerce/tree-nodes

Basic usage

In the following examples we use the following example tree structure:

Id Generator

Each tree node has a id property. To generate this id, you can specify your own IdGenerator using the interface TreeNodes\GenericIdGenerator to generate a v4 UUID.

Create a new TreeNode

The interface TreeNodes\TypedPayloadTreeNode offers a set of payload types as public constants you can use to restrict the type of the payload.

If you want to have a object as payload to just be a specific class you can simply provide the FQDN.

Adding children

TreeNodes with sorting

When you add a new sortable child the sorting will be calculated and set to the next highest sorting of the current children within the current parent node.

When you want to change the sorting of a tree node you can simply request it. Use the static method processNewSortingRequest providing the node you want to move and the new sorting.

Not only can you change the sorting within a tree node children you can even move a node with all it's children to a new position. To do that you can use the static method processMoveRequest providing the node you want to move, the new parent node e.g. Root and the new sorting it should have.

You can implement your own classes for handling sort and move requests. Simple use the interface TreeNodes\canProcessTreeNodeSortRequests.

Remove a child

Same as with adding children you can remove the children with different types by using separate functions

Testing

We use PHPUnit to automate testing and to detect issues. All unit tests are located in the phpunit.xml and run ./vendor/bin/phpunit -c phpunit.xml in your preferred CMD.


All versions of tree-nodes with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 dc-ag/tree-nodes contains the following files

Loading the files please wait ....