zawiszaty/sorted-linked-list
Composer 安装命令:
composer require zawiszaty/sorted-linked-list
包简介
Sorted linked list library with strict type safety for int or string values.
README 文档
README
Strictly typed, always-sorted singly linked list for PHP.
Overview
This library provides a SortedLinkedList data structure that:
- keeps values in ascending order after every write operation,
- supports one type per instance:
intorstring, - allows duplicates with stable order for equal values,
- exposes a small and predictable API.
Project specification:
requirements.mdHLD.md
Requirements
- PHP
^8.2 - Composer
Installation
composer install
Quick Start
<?php declare(strict_types=1); use Zawiszaty\SortedLinkedList\SortedLinkedList; $list = SortedLinkedList::forInt(); $list->addAll([3, 1, 2, 2]); echo $list . PHP_EOL; // [1, 2, 2, 3] echo $list->first() . PHP_EOL; // 1 echo $list->last() . PHP_EOL; // 3
String mode:
$list = SortedLinkedList::forString(); $list->addAll(['pear', 'apple', 'banana']); // ['apple', 'banana', 'pear']
Custom comparator:
$list = SortedLinkedList::forInt( static fn (int $a, int $b): int => $b <=> $a ); $list->addAll([1, 3, 2]); // [3, 2, 1]
Public API
SortedLinkedList::forInt(?callable $comparator = null): selfSortedLinkedList::forString(?callable $comparator = null): selfadd(int|string $value): voidaddAll(iterable<int|string> $values): voidremove(int|string $value): boolremoveAll(int|string $value): intremoveAt(int $index): voidcontains(int|string $value): boolget(int $index): int|stringfirst(): int|stringlast(): int|stringclear(): voidtoArray(): arraycount(): intisEmpty(): boolgetIterator(): Traversable__toString(): string
Exceptions
TypeMismatchExceptionIndexOutOfBoundsExceptionEmptyListException
Example Script
Run the example:
php examples/demo.php
Performance Benchmarking
Run a quick terminal benchmark:
php benchmarks/performance.php
Generate machine-readable results:
php benchmarks/performance.php --json > benchmarks/current.json
Render a human-readable report from JSON:
php benchmarks/render-report.php benchmarks/current.json
Check performance regression against the baseline (30% threshold by default):
php benchmarks/check-regression.php benchmarks/current.json benchmarks/baseline.json
Use a custom regression threshold (example 20%):
php benchmarks/check-regression.php benchmarks/current.json benchmarks/baseline.json 0.20
Quality Gates
This repository is configured with:
- PHPUnit
- PHPStan (max level)
- Psalm
- PHP CS Fixer
- Infection (mutation testing)
Current mutation gate is configured in infection.json5:
minMsi: 80.0minCoveredMsi: 80.0
Development Commands
composer test
composer stan
composer psalm
composer cs:check
XDEBUG_MODE=coverage composer infection
CI Pipeline
GitHub Actions workflow (.github/workflows/ci.yml) runs in this order:
build- static analysis in parallel:
phpstan,cs-check,psalm - in parallel after static analysis:
tests(PHP matrix) andmutation-testing
Project Layout
src/- library source codetests/- PHPUnit testsexamples/- runnable usage demorequirements.md- requirements specificationHLD.md- high-level design
zawiszaty/sorted-linked-list 适用场景与选型建议
zawiszaty/sorted-linked-list 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 zawiszaty/sorted-linked-list 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zawiszaty/sorted-linked-list 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2026-02-19