joomla/string
Joomla Framework String package for robust string handling in PHP. Installable via Composer, it provides utilities and helpers for common string operations and is maintained as part of the Joomla Framework ecosystem.
Install via Composer: composer require joomla/string. The package provides StringHelper and Inflector classes for common string operations—ideal for lightweight, framework-agnostic utilities. Start by reviewing the src/ directory (especially StringHelper.php and Inflector.php) as official docs are minimal (currently TODO). Begin with basic tasks like cleaning user input:
use Joomla\String\StringHelper;
$title = StringHelper::clean(' My Category Title '); // "My Category Title"
For pluralization/singularization:
use Joomla\String\Inflector;
$inflector = new Inflector();
$singular = $inflector->singular('categories'); // "category"
StringHelper::clean() for normalizing whitespace in titles, slugs, or search queries; StringHelper::truncate() and StringHelper::short() for preview summaries.Inflector for generating pluralized route segments or DB table names in generic CRUD scaffolding (e.g., Inflector::plural('item') → "items").Str::of()—this package adds little beyond native PHP + Doctrine Inflector.tests/ for usage examples and edge-case expectations (e.g., how truncate() handles multi-byte characters).composer.json to avoid runtime failures from auto-updates."data" → "datum", "people" → "person") aren’t guaranteed—Doctrine Inflector’s rules apply. Add custom overrides via subclassing if needed.3.0.4, 2025-07-23) fix packaging/CI, not features. Treat as stable only for basic clean/truncate—not future-proof for new functionality.clean() or short() behaves unexpectedly, verify encoding (use mb_internal_encoding('UTF-8')); v4.x drops legacy phputf8 and relies solely on symfony/polyfill-mbstring.Inflector in a service provider if used, but prefer Str::singular()/Str::plural() for consistency. This package adds maintenance cost without Laravel integration value.How can I help you explore Laravel packages today?