PHPackages                             opmvpc/constructs - 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. opmvpc/constructs

ActiveLibrary

opmvpc/constructs
=================

Data structures

1.0.1(5y ago)06[1 issues](https://github.com/opmvpc/constructs/issues)MITPHPPHP &gt;=7.2CI failing

Since Aug 2Pushed 5y ago1 watchersCompare

[ Source](https://github.com/opmvpc/constructs)[ Packagist](https://packagist.org/packages/opmvpc/constructs)[ Docs](https://github.com/opmvpc/constructs)[ RSS](/packages/opmvpc-constructs/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (5)Versions (4)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0624482dc1bc2f0bd2be065308cf6554da37fd77dffc854bdbff96b639367394/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f706d7670632f636f6e737472756374732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/opmvpc/constructs)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c50fade98c29e78f9652f2e2e143b954c44f67f2bddbeb8f22d9d61448476491/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6f706d7670632f636f6e737472756374732f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/opmvpc/constructs/actions?query=workflow%3Arun-tests+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/21b1c1a4867cb5558dbfaba55158f077f068e7f79e48c7b8846cc60dd13de245/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f706d7670632f636f6e737472756374732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/opmvpc/constructs)

Constructs
==========

[](#constructs)

Constructs provides simple data structures with a fluent api.

- Install
- Lists
    - ArrayList
    - LinkedList
- Stacks
    - ArrayStack
    - LinkedStack
- Queues
    - ArrayQueue
- Threes
    - ArrayHeap
    - SearchThree
- Helpers
    - toArray()
    - dump() &amp; dumpAndDie()

🛠 Install
---------

[](#-install)

Just add this package to your composer project:

```
$ composer require opmvpc/constructs
```

Then import Constructs main class or individual classes in your code.

Lists
-----

[](#lists)

### Available methods

[](#available-methods)

```
public static function make(): ListContract;
public function size(): int;
public function contains($item): bool;
public function add($item): ListContract;
public function remove($item): ListContract;
public function get(int $i);
public function toArray(): array;
```

### ArrayList

[](#arraylist)

#### Usage

[](#usage)

```
$list = Construct::arrayList()
    ->add(4)
    ->add(2)
    ->remove(4)
    ->add(6);
```

### LinkedList

[](#linkedlist)

#### Usage

[](#usage-1)

```
$list = Construct::linkedList()
    ->add(4)
    ->add(2)
    ->add(6);
```

### Complexity

[](#complexity)

MethodArrayListLinkedListget()O(1)O(n)add()O(1)O(1)remove()O(n)O(n)Stacks
------

[](#stacks)

### Available methods

[](#available-methods-1)

```
public static function make(): StackContract;
public function isEmpty(): bool;
public function push($item): StackContract;
public function pop(): StackContract;
public function top();
public function toArray(): array;
```

### ArrayStack

[](#arraystack)

#### Usage

[](#usage-2)

```
$stack = Construct::linkedStack()
    ->push(4)
    ->push(2)
    ->pop();
```

### LinkedStack

[](#linkedstack)

#### Usage

[](#usage-3)

```
$stack = Construct::linkedStack()
    ->push(4)
    ->push(2)
    ->pop();
```

### Complexity

[](#complexity-1)

MethodArrayStackLinkedStackisEmpty()O(1)O(1)push()O(1)O(1)pop()O(1)O(1)Queues
------

[](#queues)

### Available methods

[](#available-methods-2)

```
public static function make(): QueueContract;
public function isEmpty(): bool;
public function enqueue($item): QueueContract;
public function dequeue();
public function peek();
public function toArray(): array;
```

### ArrayQueue

[](#arrayqueue)

#### Usage

[](#usage-4)

```
$queue = Construct::linkedQueue()
    ->enqueue(4)
    ->enqueue(2)
    ->dequeue()
    ->enqueue(6);
```

### Complexity

[](#complexity-2)

MethodArrayQueueLinkedQueueisEmpty()O(1)O(1)push()O(1)O(1)pop()O(1)O(1)Threes
------

[](#threes)

### ArrayHeap

[](#arrayheap)

#### Available methods

[](#available-methods-3)

```
public static function make(): ThreeContract;
public function size(): int;
public function add($item): ThreeContract;
public function remove($item): ThreeContract;
public function get(int $i): SimpleNode;
public function toArray(): array;
```

#### Usage

[](#usage-5)

```
$heap = Construct::arrayHeap()
    ->add(4)
    ->add(2)
    ->remove(2)
    ->add(6);
```

### Complexity

[](#complexity-3)

MethodArrayHeapLinkedHeapget()O(1)O(nlog(n))add()O(nlog(n))O(nlog(n))remove()O(nlog(n))O(nlog(n))### LinkedSearchThree

[](#linkedsearchthree)

#### Available methods

[](#available-methods-4)

```
public static function make(): ThreeContract;
public function root(): Leaf;
public function min(): Leaf;
public function max(): Leaf;
public function search($key): Leaf;
public function insert($index, $item): ThreeContract;
public function toArray(): array;
public function keysArray(): array;
```

#### Usage

[](#usage-6)

```
$three = Construct::arrayHeap()
    ->insert(4, 'world')
    ->insert(2, 'hello');

    $three->min();
    $three->max();
```

### Algorithmic Complexity

[](#algorithmic-complexity)

MethodArraySearchThreeLinkedSearchThreesearch()O(2ⁿ)O(h)insert()O(2ⁿ)O(h)remove()O(2ⁿ)O(h)### Space Complexity

[](#space-complexity)

TypeSpace complexityArraySearchThreeO(2ⁿ)LinkedSearchThreeO(n)Helpers
-------

[](#helpers)

### toArray()

[](#toarray)

You can get an array representation of the current structure with the `toArray()` method.

```
$array = Construct::linkedList()
    ->add(4)
    ->toArray();
```

### dump() 🚽 &amp; dumpAndDie() ☠

[](#dump---dumpanddie-)

Constructs uses the var\_dumper Symfony component. You can use the `dump()` method on your structures.

```
$list = Construct::linkedList()
    ->add(4)
    ->dump()
    ->remove(4)
    ->dump();
```

If you are more a "Dump and die" person, `dumpAndDie()` method is also available.

```
$list = Construct::linkedList()
    ->add(4)
    ->add(2)
    ->remove(4)
    ->add(6)
    ->dumpAndDie();
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~177 days

Total

2

Last Release

2170d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14226423?v=4)[opmvpc](/maintainers/opmvpc)[@opmvpc](https://github.com/opmvpc)

---

Top Contributors

[![opmvpc](https://avatars.githubusercontent.com/u/14226423?v=4)](https://github.com/opmvpc "opmvpc (42 commits)")

---

Tags

packagedata structures

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/opmvpc-constructs/health.svg)

```
[![Health](https://phpackages.com/badges/opmvpc-constructs/health.svg)](https://phpackages.com/packages/opmvpc-constructs)
```

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.4k187.2M2.6k](/packages/composer-composer)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M286](/packages/nunomaduro-termwind)[jean85/pretty-package-versions

A library to get pretty versions strings of installed dependencies

1.3k289.5M63](/packages/jean85-pretty-package-versions)[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[bulutfon/php-sdk

Bulutfon sdk for Bulutfon-Api

101.4k](/packages/bulutfon-php-sdk)

PHPackages © 2026

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