PHP code example of code-distortion / laravel-helpers

1. Go to this page and download the library: Download code-distortion/laravel-helpers library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

code-distortion / laravel-helpers example snippets


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

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

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