Download the PHP package franzose/closure-table without Composer

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

ClosureTable

Build Status Latest Release Total Downloads

This is a database manipulation package for the Laravel 5.4+ framework. You may want to use it when you need to store and operate hierarchical data in your database. The package is an implementation of a well-known design pattern called closure table. However, in order to simplify and optimize SQL SELECT queries, it uses adjacency lists to query direct parent/child relationships.

Contents:

Installation

It's strongly recommended to use Composer to install the package:

If you use Laravel 5.5+, the package's service provider is automatically registered for you thanks to the package auto-discovery feature. Otherwise, you have to manually add it to your config/app.php:

Setup

In a basic scenario, you can simply run the following command:

Where Node is the name of the entity model. This is what you get from running the above:

  1. Two models in the app directory: App\Node and App\NodeClosure
  2. A new migration in the database/migrations directory
As you can see, the command requires a single argument, name of the entity model. However, it accepts several options in order to provide some sort of customization: Option Alias Meaning
namespace ns Custom namespace for generated models. Keep in mind that the given namespace will override model namespaces: php artisan closuretable:make Foo\\Node --namespace=Qux --closure=Bar\\NodeTree will generate Qux\Node and Qux\NodeTree models.
entity-table et Database table name for the entity model
closure c Class name for the closure model
closure-table ct Database table name for the closure model
models-path mdl Directory in which to put generated models
migrations-path mgr Directory in which to put generated migrations
use-innodb i This flag will tell the generator to set database engine to InnoDB. Useful only if you use MySQL

Requirements

You have to keep in mind that, by design of this package, the models/tables have a required minimum of attributes/columns:

Entity
Attribute/Column Customized by Meaning
parent_id Entity::getParentIdColumn() ID of the node's immediate parent, simplifies queries for immediate parent/child nodes.
position Entity::getPositionColumn() Node position, allows to order nodes of the same depth level
ClosureTable
Attribute/Column Customized by Meaning
id
ancestor ClosureTable::getAncestorColumn() Parent (self, immediate, distant) node ID
descendant ClosureTable::getDescendantColumn() Child (self, immediate, distant) node ID
depth ClosureTable::getDepthColumn() Current nesting level, 0+

Examples

In the examples, let's assume that we've set up a Node model which extends the Franzose\ClosureTable\Models\Entity model.

Scopes

Since ClosureTable 6, a lot of query scopes have become available in the Entity model:

You can learn how to use query scopes from the Laravel documentation.

Parent/Root

Ancestors

There are several methods that have been deprecated since ClosureTable 6:

Descendants

There are several methods that have been deprecated since ClosureTable 6:

Children

Siblings

Tree

There are several methods that have been deprecated since ClosureTable 6:

Collection methods

This library uses an extended collection class which offers some convenient methods:


All versions of closure-table with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 franzose/closure-table contains the following files

Loading the files please wait ....