denisok94/helper
A small Laravel/PHP helper package providing convenience functions to speed up everyday development tasks. Useful for common utilities and shortcuts so you can reduce boilerplate across projects.
deNormalize, truncatePro, and truncateGrapheme in StringHelper, expanding its scope slightly beyond basic utilities. However, domain cohesion remains unclear—these new functions are still generic string operations, raising the same alignment concerns with Laravel’s existing Str:: helpers (e.g., Str::limit(), Str::of()). The addition of grapheme-aware truncation (truncateGrapheme) is the most notable improvement, addressing a niche but critical gap for multilingual applications (e.g., emoji/non-Latin scripts).Str::limit() by offering Unicode-aware truncation, which is absent in core Laravel. This justifies its use for internationalized projects where Str::limit() fails (e.g., truncating "😊🌍" incorrectly).spatie/string for broader features (e.g., slug(), title_case()).mbstring extension (undocumented). Add this to pre-installation checks.Session fix suggests prior instability. Verify if this affects Laravel’s session handling (e.g., session()->put() interactions).truncateGrapheme() vs. Str::limit() for edge cases (e.g., surrogate pairs, zero-width characters).deNormalize() behavior with combining characters (e.g., "é" → "e").Session fix implies prior bugs, increasing long-term risk. The lack of updates (last release in 2026) remains a concern, but the new functions suggest some activity. Recommend:
Stringable features).Session fix could introduce regression risks if it alters serialization/deserialization. Audit for:
session_regenerate_id() handling).deNormalize() if it mishandles HTML entities.truncateGrapheme() may be slower than Str::limit() due to grapheme cluster analysis. Benchmark for high-traffic strings (e.g., user-generated content).Str::limit()?
truncateGrapheme() handle all Unicode edge cases better than Str::limit() + mb_strcut()?"👨👩👧👦🏽" (family emoji) vs. "Hello😊".Session fix imply changes to the BSD-3-Clause license? Check for copyleft or patent clauses.truncateGrapheme() production-tested for right-to-left scripts (e.g., Arabic, Hebrew)?mbstring is disabled?truncateGrapheme() vs. Symfony’s StringUtil or voku/portable-ascii for normalization.Str:: suffices. The package adds no value for simple ASCII use cases.truncateGrapheme() vs. Str::limit() + mb_strcut() for:
Session fix.Str::limit() calls in high-impact strings (e.g., SEO titles, previews).Helper::truncate($str, $length)) for consistency.mbstring is mandatory for grapheme functions. Add this to .php-cs-fixer.dist.php or Dockerfile.Session fix may conflict with Laravel’s session drivers (e.g., Redis, database). Test with:
session(['test' => '😊']);
session()->flush();
Session fix could interact with new session middleware (e.g., Symfony’s AbstractSessionHandler).deNormalize("é") should return "e".truncateGrapheme("👨👩👧👦🏽", 2) should return "👨" (not "👨👩").composer.json; verify mbstring is enabled.Str::limit() in multilingual strings (e.g., Post::title).php artisan session:table).deNormalize() for user input sanitization (e.g., usernames).Session issues persist.Session fix may require local patches if it conflicts with Laravel’s session logic.mbstring dependency in README.md.Session instability, maintain a private fork with:
SessionStore.Xdebug to trace Helper::truncateGrapheme() calls.mbstring misconfigurations.truncateGrapheme() may add 5–10ms latency per call in high-traffic endpoints (e.g., API responses). Optimize by:
Post::title).Str::limit() for ASCII-only content.mbstring function calls in **How can I help you explore Laravel packages today?