danielstjules/sliceable-stringy
Stringy is a PHP string manipulation library with full multibyte support, offering a fluent API for camelCase, snake_case, slugs, truncation, and more. The sliceable variant adds JavaScript-style string slicing.
substr(): The package's only real value is expressive, Python-style slicing ($str[1:-1], steps, negative offsets) in PHP. That supports a build-vs-buy decision: is the team's string-manipulation surface area large enough to justify a dependency, or is a small internal helper class the better call?substr($s, $start, $len) calls. It can inform a decision to standardize on a slice-like API, whether via this package, symfony/string, or Laravel's Str.app/Support" decision rather than taking on a package dependency.Consider it only when all of the following hold:
Look elsewhere when:
symfony/string, danielstjules/stringy (the maintained sibling), or Laravel's Str helpers instead.mb_substr or Str::substr solves it without a dependency.To executives: This is a tiny, MIT-licensed convenience library that makes PHP string slicing read like Python. It is not a strategic dependency and I do not recommend adding it to the platform — it has had no release since 2014, no downstream users, and no maintenance path, which is a support and security liability out of proportion to its benefit. If the ergonomics are genuinely valuable, we can replicate the behavior in roughly one internal helper class we own and control.
To engineering: Treat this as a reference implementation, not a dependency. The idea — negative indices, [start:stop:step] semantics, cleaner substr ergonomics — is sound and worth standardizing on. The artifact is not: it predates modern PHP typing, has no CI or recent test suite, and cannot be patched upstream. Recommended path: use symfony/string or Str for new work; vendor the single class into app/Support behind a small interface if the slice syntax is a real productivity win; avoid Composer-installing it into anything production-facing.
How can I help you explore Laravel packages today?