Download the PHP package stratadox/sorting without Composer

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

Sorting

Build Status Coverage Status Scrutinizer Code Quality

The sorting package contains tools to sort data structures like tables or collections of objects.

Sorting instructions are objects and can therefore easily be passed along as parameters. Multiple instructions can be chained in order to sort by several fields.

Installation

Install using composer:

composer require stratadox/sorting

Basic usage

2D Arrays

When sorting a collection of associative arrays, use:

Objects

In case the collection consists of objects, the sorting definition remain the same. Instead of using the ArraySorter, the ObjectSorter picks up the sorting requirements.

Method mapping

When the names of the methods do not correspond to the fields, or when a custom method is to be used for determining the sorting weight, a mapping can be given to the ObjectSorter:

Nested arrays

If the structure to be sorted consists of a list of nested arrays, one can use the NestedArraySorter:

Sorting by multiple fields

Or:

Or:

Structure

The sorting package consists of two core concepts:

This separation is maintained in order to decouple the intention of sorting from the data structure that is being sorted.

A sorting definition, for instance Sort::ascendingBy('name'), can be applied to a collection of associative arrays or to a collection of objects - the client that asks for the sorting does not need to know the internals of the elements that are to be sorted.

When designing an interface that allows for sorting, a method might accept a Sorting definition, eg. public function getSorted(Sorting $definition): array. Implementors of this interface may use any sorter they see fit, so long as they produce the expected results.

Some implementations may not even use any sorter at all, but instead take the sorting definition and produce a sorted list of results in a different way. An example of such usage might be a repository with an in-memory and an sql implementation:


All versions of sorting with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
stratadox/sorting-contracts Version ^0.3
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 stratadox/sorting contains the following files

Loading the files please wait ....