Extra helper methods for the Laravel Str helper class.
permafrost-dev/laravel-str-extras is a Laravel package for extra helper methods for the laravel str helper class..
It currently has 10 GitHub stars and 3 downloads on Packagist (latest version 1.0.1).
Install it with composer require permafrost-dev/laravel-str-extras.
Discover more Laravel packages by permafrost-dev
or browse all Laravel packages to compare alternatives.
Last updated
Extra helper methods for the Laravel Str helper class.
insert() - inserts a string at the specified position in the given string.insertAfterMatch() - inserts a string after the specified pattern match.insertAfter() - inserts a string after the specified substring.$new = Str::insert('HelloWorld', '--', 5); //returns 'Hello--World'
$new = Str::insertAfterMatch('HelloWorld', '/(Hello)/', ' '); // returns 'Hello World'
$new = Str::insertAfter('HelloWorld', 'H', '_'); // returns 'H_elloWorld'
As far as making building web applications easier - consider the following use case:
// the identifier in the database is UA-1001, but we want to
// allow the user to provide the identifier without a dash for ease of entry:
$providedIdentifier = 'UA1001';
$actualIdentifier = Str::insertAfter($providedIdentifier, 'UA', '-');
$userExists = User::where('identifier', $actualIdentifier)->exists();
You can install the package via composer:
composer require permafrost-dev/laravel-str-extras
$new = Str::insert('HelloWorld', '--', 5); //returns 'Hello--World'
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.