LaravelPackages.net
Acme Inc.
Toggle sidebar
zendraxl/laravel-string

Laravel String Object inspired by Laravel Collections

5
25
2.0.4
About zendraxl/laravel-string

zendraxl/laravel-string is a Laravel package for laravel string object inspired by laravel collections. It currently has 25 GitHub stars and 5 downloads on Packagist (latest version 2.0.4). Install it with composer require zendraxl/laravel-string. Discover more Laravel packages by zendraxl or browse all Laravel packages to compare alternatives.

Last updated

Right now if we want to do any manipulation with strings we face same problem like with an array before collections where we have to read the code inside out.

$title = Str::title(Str::replaceArray('_', [' '], Str::snake('fooBar')));

Also Str object in Laravel does not accept the string that is being manipulated as the first argument across all methods like replaceArray().

It would be great to bring that kind of power and functionality to Laravel and surpass current language limitations.

$title = (new Str('fooBar'))->snake()->replaceArray('_', [' '])->title()->get();

Also add helper function to make it even cleaner.

$title = str('fooBar')->snake()->replaceArray('_', [' '])->title()->get();

Having dd() on that object is a must :D

$title = str('fooBar')->snake()->replaceArray('_', [' '])->dd()->title()->get();

Star History Chart