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

Product Decisions This Supports

  • Standardization of PHP/Laravel Codebase: Adopt PSL to enforce consistent coding standards across teams, reducing technical debt and onboarding friction. Aligns with Laravel’s ecosystem (e.g., Taylor Otwell’s PSR-12 advocacy).
  • Developer Experience (DX) Improvements: Replace ad-hoc linting tools (e.g., PHP_CodeSniffer) with a batteries-included solution that integrates with Laravel’s IDE tooling (e.g., PHPStorm, VSCode) via built-in rules.
  • Security & Maintainability:
    • Leverage PSL’s static analysis (e.g., mutation testing via Stryker) to catch edge cases early, reducing production bugs.
    • Critical security patching: PSL 6.2.1 fixes a server-side HTTP/2 vulnerability (Psl\H2\ServerConnection) affecting untrusted client traffic. This is a must-upgrade for any Laravel app using PSL’s HTTP/2 server components directly (e.g., custom HTTP/2 endpoints). Complements Laravel’s built-in security checks (e.g., laravel-shift/laravel-debugbar).
  • Roadmap Efficiency: Accelerate feature development by reducing code review cycles for style/structure violations. Example: Use PSL’s ArrayAccess/Iterator utilities to standardize Laravel collection handling.
  • Build vs. Buy: Buy (PSL) over custom solutions or fragmented tools (e.g., combining multiple PSR packages). Avoid reinventing the wheel for:
    • Type safety (e.g., psl\Type\TypeGuard).
    • HTTP utilities (e.g., psl\Http\Client for Laravel HTTP clients).
    • Date/time handling (e.g., psl\DateTime\Duration for Laravel scheduling).
  • Use Cases:
    • Monorepos: Enforce consistency across microservices (e.g., Laravel + Lumen).
    • Legacy Migration: Modernize old PHP/Laravel apps with PSL’s backward-compatible refactoring tools.
    • Open-Source Contributions: Attract contributors with familiar, standardized patterns.
    • Security-Critical APIs: New use case: Adopt PSL for Laravel apps handling untrusted HTTP/2 traffic (e.g., public APIs, webhooks) to mitigate the 6.2.1 vulnerability. For trusted internal traffic, the risk is lower but still worth patching.

When to Consider This Package

  • Avoid if:
    • Your team already uses a mature alternative (e.g., php-cs-fixer + psr/container for DI). PSL adds ~10MB to your dependency tree; justify if you need its opinionated utilities (e.g., psl\Filesystem\Path).
    • You’re locked into a non-PSR-compliant codebase (e.g., legacy PHP 5.6). PSL requires PHP 8.0+.
    • You’re not using PSL’s HTTP/2 server components (Psl\H2\ServerConnection) and handle only trusted traffic. The 6.2.1 vulnerability is not applicable to:
      • High-level PSL APIs (e.g., psl\Http\Client).
      • Laravel’s built-in HTTP stack (e.g., Illuminate\Http\Client).
      • Client-side HTTP/2 usage.
    • Your priority is performance-critical code (e.g., high-frequency APIs). PSL’s abstractions add minor overhead (benchmark before adopting).
  • Look elsewhere if:
    • You need Laravel-specific tools (e.g., Eloquent utilities). Use spatie/laravel-package-tools instead.
    • Your team lacks PHP 8.0+ or composer maturity. PSL’s features (e.g., named arguments, attributes) require modern PHP.
    • You prefer minimalism. PSL is opinionated; opt for symfony/polyfill or ramsey/uuid for niche needs.
    • You do not handle untrusted HTTP/2 traffic. The 6.2.1 fix is only critical for server-side HTTP/2 implementations in PSL.

How to Pitch It (Stakeholders)

For Executives:

"PSL is the ‘Underscore.js’ for PHP/Laravel—it standardizes 80% of boilerplate code (e.g., validation, HTTP calls, file handling) so our team spends less time arguing about formatting and more time shipping features. Critical update: PSL 6.2.1 patches a server-side HTTP/2 vulnerability that could let attackers bypass size limits or corrupt data in APIs using PSL’s HTTP/2 server components. This is a high-priority fix for any public-facing Laravel apps using PSL’s low-level HTTP/2 features. Companies like [Example: Acme Corp] use it to reduce onboarding time by 30% and cut production bugs by 20%. It’s MIT-licensed, backed by 1.5K+ stars, and integrates seamlessly with Laravel’s ecosystem. Action required: Upgrade to 6.2.1 if you use Psl\H2\ServerConnection for untrusted traffic. The cost? A one-time migration effort (~2 dev-weeks) for a 10x long-term ROI in maintainability and security."

For Engineering:

*"PSL gives us:

  1. One tool to rule them all: Replaces PHP_CodeSniffer, PHPStan (partial), and custom scripts with a unified standard.
  2. Laravel-native utilities: Need a robust HTTP client? psl\Http\Client beats Guzzle for simple cases. Want type-safe collections? psl\Collection plays nice with Laravel’s Illuminate\Support\Collection.
  3. Future-proofing: PHP 8.1+ features (e.g., psl\Attributes) align with Laravel’s roadmap. Example: Use #[psl\Deprecated] to phase out legacy code.
  4. Security: URGENT: PSL 6.2.1 fixes a critical HTTP/2 vulnerability in Psl\H2\ServerConnection. If your app uses this for untrusted traffic (e.g., public APIs, webhooks), upgrade immediately. For trusted internal traffic, this is still a recommended patch.
  5. CI/CD win: Add a single composer require php-standard-library/psl:^6.2.1 and ./vendor/bin/psl check to your pipeline—no more flaky linting steps. Downside: Steepest learning curve for junior devs, but docs include Laravel-specific examples. Let’s pilot it on [Project X] first and audit HTTP/2 usage in [Project Y] for the 6.2.1 fix."*

For Developers:

*"PSL is like Laravel’s ‘batteries optional’—it gives you sensible defaults for:

  • Filesystems: psl\Filesystem\Path::normalize() > str_replace hacks.
  • HTTP: Chainable requests with psl\Http\Client (similar to Laravel’s HTTP client but stricter).
  • Validation: psl\Validation\Validator with Laravel-like rules but type-safe.
  • Testing: Mock HTTP responses with psl\Http\MockClient (no Guzzle dependency). Security Alert: PSL 6.2.1 fixes a critical bug in Psl\H2\ServerConnection that could let attackers send malformed HTTP/2 data. If you’re using this for public APIs or webhooks, run:
composer require php-standard-library/psl:^6.2.1

Not affected? You’re safe if you only use:

  • PSL’s high-level APIs (e.g., psl\Http\Client).
  • Laravel’s built-in HTTP stack.
  • Client-side HTTP/2. Try it: Run composer require php-standard-library/psl:^6.2.1 and check out the Laravel Integration Guide. We’ll start with the psl\Array and psl\String utilities in [GitHub Issue #123] and audit HTTP/2 usage in [GitHub Issue #456]."*
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.
apiboxsym/user-bundle
apiboxsym/health-check-bundle
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