Download the PHP package d-skora/simple-sorted-linked-list without Composer

On this page you can find all versions of the php package d-skora/simple-sorted-linked-list. 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 simple-sorted-linked-list

Simple Sorted Linked List

PHP License

A type-safe sorted singly linked list for PHP 8.2+. Items are kept in sorted order at all times, with stable scalar typing while non-empty, a pluggable sort order, and an iterator that remains safe even when the list is mutated during foreach.


Features


Installation


Quick start

Ascending list of integers

Descending list of strings

Custom comparator

Inserting and removing

Filter and merge

Safe mutation during foreach


API reference

Method Description
SortedLinkedList::create(iterable, SortOrder) Static factory
insert(int\|string) Insert preserving order
remove(int\|string): bool Remove first occurrence
removeAll(int\|string): bool Remove all occurrences
first(): int\|string Head value (throws on empty)
last(): int\|string Tail value (throws on empty)
at(int): int\|string Value at zero-based index
contains(int\|string): bool Membership check
countOccurrences(int\|string): int Count of a specific value
count(): int Total item count (Countable)
toArray(): list<int\|string> Snapshot as array
clear() Empty the list
copy() Independent copy
filter(callable): self New filtered list
merge(SortedLinkedListInterface): SortedLinkedListInterface New merged list
getIterator() foreach-compatible iterator

Sort orders

Factory Behaviour
SortOrder::ascending() Natural ascending (integers by value, strings alphabetically)
SortOrder::descending() Natural descending
SortOrder::custom(callable) Comparator fn(a, b): int — same contract as usort

Exceptions

Exception Thrown when
InvalidArgumentException Wrong scalar type inserted, incompatible scalar comparisons, or scalar-type mismatch while merging
UnderflowException first() / last() on empty list, or current() on exhausted iterator
OutOfBoundsException at() with out-of-range index
RuntimeException Custom comparator returns a non-int, or comparator is not set

Development


License

MIT © Daniel Skora


All versions of simple-sorted-linked-list with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 d-skora/simple-sorted-linked-list contains the following files

Loading the files please wait ...