Download the PHP package codrasil/closurable without Composer

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

Closurable

Latest Stable Version Total Downloads Latest Unstable Version License


Closure Table relational database implementation in PHP for any hierarchical data.

Requirements


Installation

This package is originally built for Laravel, but can also be used in any PHP project.

Read more about integration in the docs.

via composer:

Publishing Configuration

Pass in the artisan command the package's service provider:


Setup

Generating Migration File

First, run the console command to generate a nested migration table.

Format:

Example:

We will be using the users model to generate a nested relationship of users.

The command accepts an argument of referenced table. This will be the table to be "closured".

It will generate a table named userstree that comes pre-populated with the necessary columns.

The generated file should look something like below:

Note that you should generate the migration file of the referenced table yourself before running the command (in the above example, you should generate the migration for the users table yourself).

Note to change the table name of the closure table, pass in an option --table or --create:

Run php artisan make:closurable --help for more information on configuring the command.

Model usage

Next, use either of the two options on the model to be closure nested.

Following our example above, the User model should either implement:


Usage

Saving a Branch Node

Let's say we have the following data on our users table:

ID Name
1 Henry Walton Jones, Sr.
2 Indiana Jones
3 Susie Jones
4 Henry Walton Jones III

And we need the following relationship:

To save the relationships described above, we need to use the closurables() from the User model to access the attach(Model $model) method.

The relationship will be saved in the familytree table as:

ancestor_id descendant_id depth root
1 1 0 1
1 2 1 0
1 3 1 0
1 4 2 0
2 2 0 0
2 4 1 0
3 3 0 0
4 4 0 0

Visual representation:


Displaying Root Nodes

Querying for Adjacent Relations

By default, sorting is handled via the sort column found in the reference table. If the sort column is unavailable, it will default to id or whatever $this->getKeyName() will return.


Querying for Lineal Relations

For more use cases of adjacent and lineal relations, checkout Relations section in the docs.


Documentation & Examples

To learn more about the API, visit the docs folder.

For more example implementation, checkout Family Trees, and more.

License

The library is open-source software licensed under the MIT license.


All versions of closurable with dependencies

PHP Build Version
Package Version
No informations.
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 codrasil/closurable contains the following files

Loading the files please wait ....