PHPackages                             xcytek/linked\_lists - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. xcytek/linked\_lists

ActiveLibrary

xcytek/linked\_lists
====================

Linked Lists pattern

01PHP

Since Aug 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/xcytek/linked_lists)[ Packagist](https://packagist.org/packages/xcytek/linked_lists)[ RSS](/packages/xcytek-linked-lists/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

=======

Linked Lists
============

[](#linked-lists)

Linked Lists implementation in PHP

Examples How To Use all the methods available:

### Push nodes at the bottom

[](#push-nodes-at-the-bottom)

```
// Import the usage of the main classes
use Xcytek\LinkedList\LinkedList;
use Xcytek\LinkedList\Node;

// Push nodes at the end
$linkedList = new LinkedList();
foreach (range(1, 5) as $node) {
    $linkedList->push(new Node('Node #' . $node));
}
$linkedList->printList();
```

```
// Output
Linked list
"Node #1" -> "Node #2" -> "Node #3" -> "Node #4" -> "Node #5" -> null

```

### Push nodes after specific position

[](#push-nodes-after-specific-position)

```
// Push nodes after a certain position no matter if the node has other nodes pointed too.
$addAfterPosition = 2;
$nodeNinja1 = new Node('Node ninja 1');
$nodeNinja2 = new Node('Node ninja 2');
$nodeNinja3 = new Node('Node ninja 3');
$nodeNinja2->next = $nodeNinja3;
$nodeNinja1->next = $nodeNinja2;
$linkedList->pushAfterPosition($addAfterPosition, $nodeNinja1);
$linkedList->printList();
```

```
// Output
Linked list
"Node #1" -> "Node #2" -> "Node ninja 1" -> "Node ninja 2" -> "Node ninja 3" -> "Node #3" -> "Node #4" -> "Node #5" -> null

```

### Push single node after a position

[](#push-single-node-after-a-position)

```
// Push single nodes after any position
$addAfterPosition = 4;
$linkedList->pushAfterPosition($addAfterPosition, new Node('New node ninja'));
$linkedList->printList();
```

```
// Output
Linked list
"Node #1" -> "Node #2" -> "Node ninja 1" -> "Node ninja 2" -> "New node ninja" -> "Node ninja 3" -> "Node #3" -> "Node #4" -> "Node #5" -> null

```

### Push a node at the top of the list

[](#push-a-node-at-the-top-of-the-list)

```
// Push a node at the top of the list
$linkedList->pushAtTop(new Node('First ninja node'));
$linkedList->printList();
```

```
// Output
Linked list
"First ninja node" -> "Node #1" -> "Node #2" -> "Node ninja 1" -> "Node ninja 2" -> "New node ninja" -> "Node ninja 3" -> "Node #3" -> "Node #4" -> "Node #5" -> null

```

### Delete a node given a position

[](#delete-a-node-given-a-position)

```
// Remove single node given a position
$linkedList->deleteAtPosition(3);
$linkedList->printList();
```

```
// Output
Linked list
"First ninja node" -> "Node #1" -> "Node ninja 1" -> "Node ninja 2" -> "New node ninja" -> "Node ninja 3" -> "Node #3" -> "Node #4" -> "Node #5" -> null

```

### Clear the entire list

[](#clear-the-entire-list)

```
// Clear the whole list
$linkedList->clear();
$linkedList->printList();
```

```
// Output
 [List Empty]

```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7b8fabd37ed635ec45e703d1a67b06171be33f156c04ef20a9e8af341c0ab137?d=identicon)[xcytek](/maintainers/xcytek)

---

Top Contributors

[![xcytek](https://avatars.githubusercontent.com/u/1552538?v=4)](https://github.com/xcytek "xcytek (7 commits)")

### Embed Badge

![Health badge](/badges/xcytek-linked-lists/health.svg)

```
[![Health](https://phpackages.com/badges/xcytek-linked-lists/health.svg)](https://phpackages.com/packages/xcytek-linked-lists)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
