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 (PHP Standard Library) offers a consistent, well-typed set of safer, async-ready APIs to replace PHP primitives. Covers async, collections, networking, I/O, cryptography, terminal UI, and type-safe data validation with predictable errors.

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.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle