Download the PHP package neurony/laravel-sort without Composer

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

Sort Eloquent model records by their attributes or relationships

Build Status StyleCI Scrutinizer Code Quality

Overview

This package allows you to sort Eloquent model records by their attributes, or via their relationships.

Relationship types that can be sorted by: hasOne, belongsTo

Installation

Install the package via Composer:

Usage

Step 1

Your Eloquent models should use the Neurony\Sort\Traits\IsSortable trait.

Step 2

You would access by whatever means the desired URI that specifies how the sort should behave:

Please note the sort and direction parameters!

These are very important if you're using the IsSortable trait, as these two parameters are default for defining the:

To see how to change these parameters, please see the Extra section.

Step 3

Once you've used the Neurony\Sort\Traits\IsSortable trait in your Eloquent models and you've supplied the correct sorting parameters, you can sort the model records by using the sorted() query scope present on the trait.

The sorted query scope receives a mandatory first argument, that should be an associative array containing the field to sort by and the direction to sort in:

Extra

Sorting by relationship

To sort Eloquent model records by a relationship, use the following format when specifying the sort parameter:
{relationship_name}.{relationship_attribute}

Please note that you can only sort by relationships of type belongsTo or hasOne.

Changing the sorting parameters

In Step 2 we've talked about the importance of specifying the parameters that tell the trait the field to sort by and the direction to sort it.

If you wish, those fields can be changed to other fields.

In order to do that, you'll have to create a Sort object that will extend the abstract Sort object that comes with this package.

After you've created the sort object, pass it as the second argument to the sorted query scope when sorting your model records.

For the example above, your URI should look like this:

Credits

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

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

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.


All versions of laravel-sort with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
illuminate/contracts Version ^6.0
illuminate/support Version ^6.0
illuminate/database Version ^6.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 neurony/laravel-sort contains the following files

Loading the files please wait ....