Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Psl Laravel Package

azjezz/psl

PSL is a modern, well-typed standard library for PHP 8.4+, inspired by HHVM’s HSL. It offers safer, predictable APIs for async, collections, networking, I/O, crypto, terminal UI, and robust data validation—replacing brittle built-ins with consistent alternatives.

View on GitHub
Deep Wiki
Context7

DataStructure

The DataStructure component provides three classic data structures: Queue (FIFO), Stack (LIFO), and PriorityQueue. They are generic, type-safe, and offer a consistent API with both safe and throwing access methods.

Queue (FIFO)

A queue processes items in first-in, first-out order. Items are added to the back and removed from the front:

@example('collections/data-structure-queue.php')

Use pull() when an empty queue is a normal condition (it returns null). Use dequeue() when an empty queue is a bug (it throws UnderflowException).

Stack (LIFO)

A stack processes items in last-in, first-out order. Items are added to and removed from the top:

@example('collections/data-structure-stack.php')

Use pull() for safe access (returns null if empty) and pop() when emptiness is unexpected (throws UnderflowException).

PriorityQueue

A priority queue dequeues items with the highest priority first. Items with equal priority are dequeued in FIFO order:

@example('collections/data-structure-priority-queue.php')

If no priority is specified, items default to priority 0.

Common API

All three structures implement Countable and share a consistent pattern:

Method Queue Stack PriorityQueue
Add item enqueue($item) push($item) enqueue($item, $priority)
Peek at next peek() peek() peek()
Remove (safe) pull() pull() pull()
Remove (throws) dequeue() pop() dequeue()
Count items count() count() count()
  • peek() returns the next item without removing it, or null if empty
  • pull() removes and returns the next item, or null if empty
  • dequeue() / pop() removes and returns the next item, or throws UnderflowException if empty

See src/Psl/DataStructure/ for the full API.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4