PHP code example of whitecube / laravel-string-typography

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

    

whitecube / laravel-string-typography example snippets


$content = 'Mama mia !';

echo str($content)->typography();

use Whitecube\Strings\Typography;

Typography::rule(
    key: 'a-to-b',
    regex: '/a/',
    callback: fn(array $matches) => 'b',
);

use Whitecube\Strings\Typography;

Typography::remove('a-to-b');
blade
{{-- Using the "Str" facade --}}
<h1>{!! Str::typography($title) !!}</h1>

{{-- Using the "str()" helper --}}
<p>{!! str($paragraph)->typography() !!}</p>
blade
<div>{!! str($text)->markdown()->typography() !!}</div>
blade
<div>{!! str($text)->typography(only: 'hellip') !!}</div>
<div>{!! str($text)->typography(only: ['hellip', 'non-breaking-punctuation']) !!}</div>
blade
<div>{!! str($text)->typography(except: 'hellip') !!}</div>
<div>{!! str($text)->typography(except: ['hellip', 'non-breaking-punctuation']) !!}</div>