Download the PHP package telkins/laravel-dag-manager without Composer

On this page you can find all versions of the php package telkins/laravel-dag-manager. 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?
telkins/laravel-dag-manager
Rate from 1 - 5
Rated 1.00 based on 1 reviews

Informations about the package laravel-dag-manager

A SQL-based Directed Acyclic Graph (DAG) solution for Laravel

Latest Stable Version run tests Total Downloads License

This package allows you to create, persist, and remove directed acyclic graphs.

Basic Usage

Creating a direct edge:

Deleting a direct edge:

Installation

This package requires PHP 7.2 or higher as well as Laravel 6.0 or higher.

You can install the package via composer:

The package will automatically register itself.

You can publish the migration with:

Note: The default migration assumes you are using integers for your DAG edge IDs.

You can optionally publish the config file with:

This is the contents of the published config file:

Warning

From Kemal Erdogan's article, "A Model to Represent Directed Acyclic Graphs (DAG) on SQL Databases":

In theory, the size of the transitive closure set of a fair DAG can be very large with this model, well beyond the millions. The maximum number of edges for a given DAG itself is a research topic in Graph Theory, but my practical tests show that there exist DAGs with 100 vertices and 300 edges whose transitive closure would create well beyond 20,000,000 rows with this algorithm.

Please be mindful of this when creating "excessively" large and/or complex graphs.

Usage

For Eloquent models that are "DAG managed", you can add the Telkins\Models\Traits\IsDagManaged trait:

This will allow you to easily access certain functionality from your model class.

To apply a scope that only includes models that are descendants of the specified model ID:

An ID and source must be provided.

Likewise, to apply a scope that only includes models that are ancestors of the specified model ID:

Again, an ID and source must be provided.

Finally, one can apply a scope that will get both ancestors and descendants:

Each of the aforementioned methods also allow the caller to constrain the results based on the number of hops. So, if you want to get the immediate children of the specified model ID, then you could do the following:

And, of course, in order to get the parents and grandparents of the specified model ID, you could do the following:

Not providing the $maxHops parameter means that all descendants, ancestors, or relations will be returned.

Custom DAG edge model

You can use your own model class if you need to customise the behavior of the DAG edge model.

Your custom model class must extend the Telkins\Models\DagEdge class:

You can then specify the fully qualified class name of your custom model in the package config file.

Testing

Additional Notes

Contributors may want to consider leveraging any of the following:

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

tbd

Credits

Additionally:

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-dag-manager with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0
illuminate/database Version ^11.0
illuminate/support Version ^11.0
spatie/laravel-data Version ^4.6
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 telkins/laravel-dag-manager contains the following files

Loading the files please wait ....