Weave 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

Str Laravel Package

php-standard-library/str

Unicode-aware string functions for PHP that replace mb_* and standard string functions with a consistent, modern API. Part of the PHP Standard Library, Str offers reliable multibyte-safe handling for everyday string operations.

View on GitHub
Deep Wiki
Context7

PHP Standard Library - Str provides Unicode-aware string functions that replace PHP's mb_* and standard string functions with a consistent, predictable API. Built as part of the PHP Standard Library, it handles multibyte characters correctly so string length, slicing, and case operations behave as expected across languages and scripts.

  • Consistent Unicode-safe handling for length, slicing, and case conversion
  • Drop-in replacements for mb_* and native string functions
  • Predictable behavior across encodings and locales
  • Part of the modular php-standard-library ecosystem
  • Well-documented API at php-standard-library.dev
Frequently asked questions about Str
What is php-standard-library/str and what does it replace?
php-standard-library/str is a Composer package that provides Unicode-aware string functions for PHP. It is intended to replace PHP mb_* functions and standard string functions with a consistent, well-tested API. It is part of the broader PHP Standard Library project and has zero hard dependencies.
Does php-standard-library/str work with Laravel?
Yes, it can be installed in a Laravel application because it is a framework-agnostic Composer package with no service provider or container coupling. The main integration friction is namespace collision with Illuminate\Support\Str, so you must alias one of the classes in your use statements. It does not integrate with Laravel's Stringable or framework helpers automatically.
How do I install php-standard-library/str in a Laravel project?
Install it with composer require php-standard-library/str. No configuration, service provider registration, or publish step is required. In files that also use Laravel's Str helper, alias the imported class to avoid collisions, for example use PhpStandardLibrary\Str\Str as UnicodeStr.
Is php-standard-library/str a good replacement for Laravel's Str helper?
By default it is redundant because Laravel already ships Illuminate\Support\Str and Stringable, both mbstring-backed and framework-integrated. Adoption is only justified if you can demonstrate a specific Unicode gap that Laravel's helpers do not cover. If a method-level comparison shows nothing material, standardizing on the framework helper is the safer choice.
What Unicode features might justify using php-standard-library/str over Illuminate\Support\Str?
The candidate gaps to test are grapheme-cluster-safe truncation, Unicode normalization forms such as NFC and NFD, locale-sensitive casing such as Turkish dotless i and German sharp s, and width-aware string operations. These are the areas where a dedicated Unicode string library could add value. You should verify each behavior against your Laravel version before adopting it.
Which Laravel versions support php-standard-library/str?
The package is not tied to a specific Laravel version because it is a standalone PHP library with no Laravel framework dependency. Compatibility is determined by its PHP version constraint in Composer rather than by the Laravel release line. Check the package's composer.json and test against your application's PHP runtime before upgrading.
How should I test php-standard-library/str in a Laravel application?
Because the package exposes stateless pure functions, it is easy to wrap behind an internal adapter and unit test directly. Focus tests on Unicode edge cases such as combining marks, normalization idempotence, invalid UTF-8 input, and empty or null coercion. Pin the exact version and review behavior when upgrading, since release notes for 6.3.0 were only a pointer to the parent monorepo.
What are the production risks of adopting php-standard-library/str?
Intrinsic code risk is low because the surface is small and composed of pure functions, but correctness risk is concentrated in the Unicode semantics that are the reason to consider it. Transparency risk is higher: version 6.3.0 was a minor release with no changelog or diff summary in the package artifact, so silent behavioral drift cannot be ruled out. Low adoption, zero dependents, and single-source maintenance also make breakage less likely to surface early.
How does php-standard-library/str compare to symfony/string?
Both address Unicode-aware string handling, and many Laravel stacks already pull symfony/string transitively through other dependencies. php-standard-library/str would be a third implementation of the same concern alongside Illuminate\Support\Str and Symfony String. The published material does not provide a method-level diff proving a material advantage over either alternative.
Is php-standard-library/str actively maintained?
Yes, the project is still releasing versions, and the version line advanced from 6.2.x to 6.3.0 as a minor bump under semantic versioning. However, the 6.3.0 release notes were only a hyperlink to the parent monorepo release page, with no changelog, feature list, deprecations, or breaking-change notice. That pointer-only pattern has now appeared across at least two releases, so treat upgrades as opaque until you review the monorepo diff yourself.
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.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core