mathalubos/sorted-linked-list

A sorted linked list implementation in PHP.

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 1

pkg:composer/mathalubos/sorted-linked-list

1.0.1 2025-06-12 13:26 UTC

This package is auto-updated.

Last update: 2025-12-29 17:42:34 UTC


README

A sorted linked list implementation in PHP with support for int and string elements and customizable sort order defaulting to ASC.

Installation

composer require mathalubos/sorted-linked-list

Usage

use Mathalubos\SortedLinkedList\Enum\SortEnum;
use Mathalubos\SortedLinkedList\IntSortedLinkedList;

$sortedLinkedList = new IntSortedLinkedList(SortEnum::ASC);
$sortedLinkedList->add(5);
$sortedLinkedList->add(3);
$sortedLinkedList->add(7);

foreach ($sortedLinkedList as $item) {
    echo $item;
}

// outputs: 3, 5, 7

Coding standards

  • To check coding standards, run commands:
  • ./vendor/bin/php-cs-fixer fix
  • ./vendor/bin/phpstan analyse

Tests

  • To run all tests execute:
  • ./vendor/bin/phpunit tests