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

Detect Packages

The detect-packages command scans PHP source directories for PSL namespace usage and reports which php-standard-library/* standalone packages are needed. This helps migrate from the monorepo to individual packages.

This tool is only available when using the monorepo (php-standard-library/php-standard-library).

Usage

vendor/bin/psl detect-packages <path>... [--dev <path>...] [--composer]

Options

Option Description
--src Mark following paths as require dependencies (default)
--dev Mark following paths as require-dev dependencies
--composer Output a JSON snippet for composer.json

Examples

Basic scan

Scan a single source directory:

vendor/bin/psl detect-packages src/
Detected PSL packages:

  require:
    php-standard-library/dict
    php-standard-library/foundation
    php-standard-library/str
    php-standard-library/vec

Separating require and require-dev

Scan source and test directories separately. Packages found in both are placed in require only:

vendor/bin/psl detect-packages src/ --dev tests/
Detected PSL packages:

  require:
    php-standard-library/dict
    php-standard-library/foundation
    php-standard-library/str
    php-standard-library/vec

  require-dev:
    php-standard-library/filesystem
    php-standard-library/os

JSON output for composer.json

Use --composer to get output you can paste directly into your composer.json:

vendor/bin/psl detect-packages src/ --dev tests/ --composer
{
    "require": {
        "php-standard-library/dict": "^6.1",
        "php-standard-library/str": "^6.1",
        "php-standard-library/vec": "^6.1"
    },
    "require-dev": {
        "php-standard-library/filesystem": "^6.1",
        "php-standard-library/os": "^6.1"
    }
}

Multiple source paths

You can pass multiple directories. Bare paths default to require:

vendor/bin/psl detect-packages src/ lib/ --dev tests/

How it works

The tool scans all .php files in the given directories and matches Psl\<Namespace> references using regex. Each namespace is mapped to its corresponding standalone package. The foundation package is always included when any PSL usage is detected, since all PSL packages depend on it.

Transitive dependencies are not resolved — only direct usage in your code is reported. Composer handles transitive dependencies automatically when you install the standalone packages.

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