PHP code example of revolution / laravel-str-mixins

1. Go to this page and download the library: Download revolution/laravel-str-mixins 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/ */

    

revolution / laravel-str-mixins example snippets


$text = Str::textwrap(str: 'abcde', width: 3);

// abc
// de

$text = Str::kana(str: 'abcあいうアイウ', option: 'KVa');

// abcあいうアイウ

$text = Str::limit('abcあいうえお', 7);

// abcあい...

$text = Str::truncate(str: 'abcあいうえお', limit: 7);

// abcあいうえ...

$text = Str::of('abcde')->textwrap(width: 3)->value();

// abc
// de

$text = Str::of('abcあいうアイウ')->kana(option: 'KVa')->value();

// abcあいうアイウ

$text = Str::of('abcあいうアイウ')->kana(option: 'KVa')->textwrap(3)->value();

// abc
// あいう
// アイウ

$text = Str::of('abcあいうえお')->truncate(limit: 6, end: '___')->value();

// abcあいう___