PHP code example of victoryoalli / laravel-string-macros

1. Go to this page and download the library: Download victoryoalli/laravel-string-macros 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/ */

    

victoryoalli / laravel-string-macros example snippets


Str::stripTags('<strong>Hello</strong> <i>World!</i>');
// Hello World!

$str = Str::of('Hac non ? dolor nisi penatibus maecenas luctus purus rutrum, ? leo sed ut lacinia gravida primis aliquet eget finibus, consequat sapien platea urna vehicula adipiscing est tortor.')->interpolate(['RED','BLUE'])->initials(28)->upper();
echo $str;
// HNRDNPMLPRBLSULGPAEFCSPUVAET

 php
Str::initials('Victor Yoalli Dominguez'); //default to 2 initials
// VY

Str::initials('Victor Yoalli Dominguez',3);
// VYD
 php
Str::interpolate('Roses are ? Violets are ?','RED','BLUE');
// Roses are RED Violets are BLUE

Str::interpolate('Roses are ? Violets are ?',['RED','BLUE']);
// Roses are RED Violets are BLUE

Str::interpolate('Roses are ? Violets are ?',...['RED','BLUE']);
// Roses are RED Violets are BLUE