Download the PHP package thoss/laravel-gap-sort without Composer

On this page you can find all versions of the php package thoss/laravel-gap-sort. 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 laravel-gap-sort

Sortable behaviour for Eloquent models with gap algorithm

GitHub Workflow Status GitHub Workflow Status Latest Version Latest Version on Packagist

This package provides a way to sort items in a table using the "Gap" algorithm, which is a more efficient way of reordering items in a table than using incremental values. It takes into account the gap between the order values of adjacent items and calculates the new order value for the main item based on the positions of the previous and next items.

So you can sort an item to any position with just one operation, you don't have to change other items!

Description of the class Thoss\GapSort\SortModel

Requirement

Installation

You can install this package using composer.
Just run the command below.

Optionally you can publish the config file with:

This is the content of the file that will be published in config/gap-sort.php

Usage

To add sortable behaviour to your model you must:

  1. Use the trait Thoss\GapSort\Traits\Sortable in your Model.
  2. Optionally specify which column will be used as the order column. The default is order_column.
  3. Optionally specify which gap between the sorted items you want to use. The default is order_gap.

The larger the gap, the lower the probability that the table will have to be reinitialized

  1. You can initialize an existing Table with the order gap, maybe in a Migration file

Use the sorting with an REST API

  1. register /sort Route
    (with the enabled resource registrar you can easily add the /sort Route)

  2. Dispatch the SortModel Job in your Controller

Example Requests with a 100 gap

Item1 is sorted between 2 and 3

Item1 is sorted to the last

Item3 is sorted to the first

Testing

Alternatives


All versions of laravel-gap-sort with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/database Version ^9.0|^10.0
illuminate/support Version ^9.0|^10.0
spatie/laravel-package-tools Version ^1.9
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 thoss/laravel-gap-sort contains the following files

Loading the files please wait ...