PHP code example of schibsted-tech-polska / php-content-stylizer

1. Go to this page and download the library: Download schibsted-tech-polska/php-content-stylizer 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/ */

    

schibsted-tech-polska / php-content-stylizer example snippets


$text = 'Sample text';
$markups = [
    [
        'length' => 6,
        'offset' => 0,
        'type' => 'strong',
    ],
];

$html = $stylizer->getHtml($text, $markups);

$stylizer->addTag('link', function (\stdClass $params) {
    return '<a href="' . $params->uri . '" target="_blank">;
}, '</a>');