Download the PHP package dede/lexorank without Composer

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

LexoRankTrait - A Trait for Managing Sortable Positions in Laravel Models

The LexoRankTrait is a trait that simplifies the process of managing sortable positions within your Laravel models. It provides functionality for dynamically calculating and managing the "position" or "rank" of items in a list. This is useful for scenarios where you want to reorder items without relying on fixed indices.

Features

Installation

  1. Add the trait to your model:

    In order to use LexoRankTrait, simply include it in your model:

  2. Override the applySortableGroup method (optional):

    If you want to apply custom query conditions (e.g., sorting within groups like mogou_id or sub_mogou_id), you can override the applySortableGroup method in your model:

  3. Run Migrations:

    Ensure that the table youre using with the trait has a sortable field (like position) to store the rank. If your model uses position, make sure the database schema is ready to store it:

Methods

  1. bootLexoRankTrait()

    • The traits bootLexoRankTrait() method automatically assigns the next available position when creating a new model. You can customize how the max position is calculated by overriding the applySortableGroup method.
  2. scopeSorted($query)

    • Use this scope to retrieve models ordered by their position field.

    Example:

  3. moveAfter($entity)

    • Moves the current model after another model (recalculating positions accordingly).

    Example:

  4. moveBefore($entity)

    • Moves the current model before another model (recalculating positions accordingly).

    Example:

  5. resetPositions

    • Resets the positions of all models in the table.

    Example:

  6. getNewPosition($prev, $next, $isMoving = false)

    • Generates a new position based on the positions of two other models.
  7. previous($limit = 0)

    • Gets the previous models relative to the current model.
  8. next($limit = 0)

    • Gets the next models relative to the current model.
  9. siblings($isNext, $limit = 0)

    • Retrieves models that are either before or after the current model based on the position field.
  10. getPrevious($limit = 0)

    • Gets a collection of the previous models.
  11. getNext($limit = 0)

    • Gets a collection of the next models.

Example Usage

Customizing the Sortable Field

If you want to use a different field as the sortable field, you can override the $sortableField property in your model:

Notes

License

MIT License


All versions of lexorank with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.5
illuminate/contracts Version ^10.0||^11.0
laravel/framework Version *
spatie/laravel-package-tools Version ^1.16
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 dede/lexorank contains the following files

Loading the files please wait ...