Download the PHP package rundiz/nested-set without Composer

On this page you can find all versions of the php package rundiz/nested-set. 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 nested-set

NestedSet

The PHP nested set model for create/read/update/delete the tree data structure (hierarchy).

Latest Stable Version License Total Downloads

A class that help you to query complex data of nested set.

Example

Install

I recommend you to install this library via Composer and use Composer autoload for easily include the file. If you are not using Composer, you have to manually include the file by yourself.
Please make sure that the path to files are correct.

If you want to make sure or see how class is working please following the step below, otherwise skip this step.
Import tests/common/test-database-structure.sql file to the database.


Connect to DB

This class is using PDO class. Please connect to PDO and send the \PDO object to the class constructor.


Insert the data

Before insert, you can get new position of that taxonomy level using getNewPosition() method.

Everytime you insert the data, you have to run rebuild() method to generate level, left, right data. The incorrect level, left, right data can cause incorrect listing.


Update the data

To update the data, you don't need new position for this but you have to run rebuild() method every time.

Check parent under children

If you want to change the parent of selected item, you can check first that the new parent of selected item is under children of selected item or not.
You can use isParentUnderMyChildren() method to check this and false means correct parent (new parent is not children of editing item).
To continue on this please use the data in demo-data.sql file.


Read the data

To read the selected item data with its children, you can use getTaxonomyWithChildren() method.

To read the selected item data with its parent in a line until root item, you can use getTaxonomyWithParents() method.

List the items

You can list the items by use listTaxonomy() method for nested array data or use listTaxonomyFlatten() for flatten data.

Both methods parameters are same.


Delete an item

You can choose how to delete an item.

  1. Delete selected item and ALL of its children.
  2. Delete selected item and pull up its children to the current parent.

Every time you deleted, you have to run the rebuild() method to correct level, left, right data.

Delete selected item and ALL of its children.

Delete selected item and pull up its children to the current parent.

For more example including complex conditions which is new feature since v 1.x, please take a look in tests/phpunit folder or the API document in .wiki/apidoc folder.


All versions of nested-set with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.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 rundiz/nested-set contains the following files

Loading the files please wait ....