Download the PHP package antikirra/array-sort without Composer

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

Human-readable array sorter for PHP

Packagist Dependency Version Packagist Version

Install

Sorting Order Options

This library provides three primary sorting methods for arrays: by key, by value, and by a custom user-defined function. To apply your preferred sorting method, simply use the appropriate static method from the base facade - ::byKey(), ::byValue() or ::byFunction(callable).

Default Key Association

By default, array values are sorted while preserving their original keys. This behavior aligns with typical expectations when using sorting functions. If you prefer to reindex keys without making additional array_values() calls, simply use the ->resetKeys() method.

Custom Sorting for Multidimensional Arrays

Custom function-based sorting is available for those rare cases involving multidimensional arrays. Unfortunately, the standard interface for interacting with such arrays is quite limiting and lacks elegance, making it challenging to implement a facade that remains backward-compatible with earlier PHP versions. However, you can use the ::asc and ::desc helpers to specify elements at any desired depth within nested arrays.

Be extremely cautious! Changing the order of parameters can reverse the sorting result. Always ensure that the argument order in the outer function matches that in the inner function to maintain the expected sorting behavior.

Default Sorting Behavior

When sorting by key or by value, you can specify the sorting order: either ascending or descending - ->asc() or ->desc(). By default, sorting is performed in ascending order. Explicitly calling the ->asc() method is optional and recommended only when it improves code readability.

Performance and Array Integrity

Native PHP array-sorting functions are designed for maximum performance and minimal memory usage. However, in everyday use, you might often need to keep the original array intact. You can use the ->sortCopy($array) method to create a copy of the original array and then apply sorting. Alternatively, the ->sort(&$array) method performs sorting directly on the array as expected.

Basic usage


All versions of array-sort with dependencies

PHP Build Version
Package Version
Requires php Version ^5.6 || ^7.0 || ^8.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 antikirra/array-sort contains the following files

Loading the files please wait ....