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

Regex

The Regex component provides type-safe regular expression functions. PHP's preg_* functions return false on invalid patterns and use null for unmatched groups, making it easy to silently propagate errors. PSL's Regex functions throw InvalidPatternException for bad patterns and support typed capture groups so you know exactly what shape your matches will have.

Usage

Checking for Matches

@example('text/regex-matching.php')

Extracting Matches

first_match() returns the first match as an array, or null if nothing matched:

@example('text/regex-first-match.php')

Typed Capture Groups

Pass a Type shape to get a well-typed result that validates the match structure at runtime:

@example('text/regex-typed-capture.php')

The capture_groups() helper builds a shape type from a list of expected group keys:

@example('text/regex-capture-groups.php')

Finding All Matches

every_match() returns all matches as a list, or null if none matched:

@example('text/regex-every-match.php')

Search and Replace

@example('text/regex-replace.php')

Splitting

@example('text/regex-split.php')

Error Handling

All functions throw instead of returning error sentinels. An invalid pattern like /unclosed(group throws Regex\Exception\InvalidPatternException immediately rather than returning false.

See src/Psl/Regex/ 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