LaravelPackages.net
Acme Inc.
Toggle sidebar
code-distortion/laravel-helpers

Various helpers and tools for Laravel

552
0
0.1.4
About code-distortion/laravel-helpers

code-distortion/laravel-helpers is a Laravel package for various helpers and tools for laravel. It currently has 0 GitHub stars and 552 downloads on Packagist (latest version 0.1.4). Install it with composer require code-distortion/laravel-helpers. Discover more Laravel packages by code-distortion or browse all Laravel packages to compare alternatives.

Last updated

Laravel Helpers

Latest Version on Packagist PHP Version Laravel GitHub Workflow Status

Warning

This package was developed for use in my own projects. It might not suit your needs or be documented properly, and may change at any time.

Installation

Install the package via composer:

composer require code-distortion/laravel-helpers

The package will automatically register itself.

String Macros

These macros are applied to Illuminate\Support\Str and Illuminate\Support\Stringable:

unspace

Trim and remove repeated-spaces from a string:

// ' a  b  c ' >> 'a b c'
Str::unspace($string);
Str::of($string)->unspace();

By default, all whitespace characters are searched for and replaced with spaces.

You can specify which character/s to search for:

// '_a__b__c_' >> 'a_b_c'
Str::unspace($string, '_');
Str::of($string)->unspace('_');

Searching for an empty string will search for all whitespace characters.

And you can specify a replacement:

// ' a  b  c ' >> 'a-b-c'
Str::unspace($string, ' ', '-');
Str::of($string)->unspace(' ', '-');

If no replacement is specified, the character being searched for will be used.

If more than one character is being searched for, a space is used as the replacement.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Contributions are not being sought for this package.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Star History Chart