Download the PHP package goutte/tree-bundle without Composer

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

TreeBundle

The Tree structure is currently designed with only one model, the Node.

Provides a service for serializing and unserializing nodes, to and from strings such as A(B,C(D)).

Drivers provided :

See the Tests for more examples of what the Drivers support.

How to Use

This is not for storing nested sets in the database, if that is what you are looking for you should be looking at Doctrine Extensions. The original purpose of this bundle is to provide a toolset for reading/writing functional code, or configuring the hierarchy of a menu in plain text for example.

Feel free to extend it to suit your needs, though.

Install

Add this bundle to your project using composer

composer require goutte/tree-bundle

Service

Use the service from the container :

See Goutte\TreeBundle\Is\Node for a list of the methods provided by the abstract class Goutte\TreeBundle\Model\AbstractNode.

Using your own Node

Extending

Implementing

Then, configure the service to use your own Node class.

Writing a Driver

Implement Goutte\TreeBundle\Is\Driver as follows :

The __construct part is optional, but you'll probably want a NodeFactory to create Nodes. We provide a default Node Factory as service, see the <argument> in the service definition below.

Add your driver to your services.xml, and tag it goutte_tree.driver :

(warn) The service id will define the driver alias, so it needs to start with goutte_tree.driver.. It is not the documented way of doing such a thing (which would be having an alias attribute in the tag), but it is a bit DRYer. This may be subject to change later, I'm still making up my mind.

Configure the service to use your custom driver with ->useDriver() :

You may skip usage of ->useDriver() by telling the service to use your driver as default in the services.xml :

Testing

This bundle is ruthlessly tested, except for some service configuration exceptions (if you know how to test these, I'm all ears!)

Run composer with the --dev option so that the autoloader is created and the needed sf2 DIC classes are autoloaded. Oddly enough, when I tried to install with --test and require-test in the composer.json, I was sent packing. (pun intended)

composer install --dev

Then, simply run

phpunit

Pitfalls

Parenthesis Driver

Nodes with empty label can convert to string, but not back to node.

Eg: A(B,C) tree, if nodes' labels are emptied, will convert back to (,)

Envisioned solutions :

Timbre Driver

The nodes labels are not escaped by the driver, so no (, ) or ,. As these characters are not used by Timbre's nodes, this should not be a problem.

Numerical labels must be encapsulated in T(), like so : T(66.2).

Ascii Driver

Linebreaks will be (un)escaped so that labels stay on one line in the string representation.

Because the reader expects exactly 2 - as indentation, the Node label will hold the extra - if you add more.

Eg:

A
+---B

=> The child node's label will be -B, not B.

ChangeLog

v1.0

v1.5

v1.6

v1.7.1

v1.7.4

v1.7.5

RoadMap

These have no schedule, don't wait for them.

v1.8

v2.0


All versions of tree-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
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 goutte/tree-bundle contains the following files

Loading the files please wait ....