Download the PHP package winponta/treevel without Composer

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

treevel

Installation

  1. Require this package in your composer.json file and run composer install (or run composer require winponta/treevel directly):

    "winponta/treevel": "0.*"

  2. Run copmposer:

    composer update

Using

Enable your models to be ready to handle tree hierarchy records, using one of the traits of the package (for now only Parent tree model is available).

Parent tree model

Parent tree models are handled using parent id references.

Trait

<?php
    ...
    class MyModel extends Eloquent {
        use \Winponta\Treevel\Traits\ParentTreeModel;

Default properties

Parent primary key (parentIdField)

This property is used to resolve the parent table primary key. If it's null the Eloquent primaryKey model property is used. You can change this value customizing the database field name your table/collection is using. Do this by setting the property calling the setParentIdField method in the model __constructot:

<?php
    ...
    class MyModel extends Eloquent {
        use \Winponta\Treevel\Traits\ParentTreeModel;

        public function __construct() {
            $this->setParentIdField( 'pk_on_parent_table' );
        }
Parent references (parentField)

The default field name used by the package to handle the reference value to the parent record is named parent_id, you can change this value customizing the database field name your table/collection is using. Do this by setting the property calling the setParentField method in the model __constructot:

<?php
    ...
    class MyModel extends Eloquent {
        use \Winponta\Treevel\Traits\ParentTreeModel;

        public function __construct() {
            $this->setParentField( 'my_father_id' );
        }
Node level property (levelField)

This property controls the deep level of the node in the tree. The default field value used to handle this feature is named node_level, you can change this value customizing the database field name your table/collection is using. Do this by setting the property calling the setLevelField method in the model __constructot:

<?php
    ...
    class MyModel extends Eloquent {
        use \Winponta\Treevel\Traits\ParentTreeModel;

        public function __construct() {
            $this->setLevelField( 'depth' );
        }

Retrieving the tree

getTree

Returns the full tree from database as a Eloquent Collection

  • where => [key, value] - recover only descendants the key matches the value

All versions of treevel with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
laravel/framework Version 5.*
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 winponta/treevel contains the following files

Loading the files please wait ....