PHP code example of jorisnoo / statamic-safe-entities

1. Go to this page and download the library: Download jorisnoo/statamic-safe-entities 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/ */

    

jorisnoo / statamic-safe-entities example snippets


return [
    'entities' => [
        '&shy;' => 'Soft Hyphen',
        '&nbsp;' => 'Non-Breaking Space',
        '&ndash;' => 'En Dash',
    ],
];

use Noo\SafeEntities\SafeEntities;

$text = SafeEntities::render($value);
$html = SafeEntities::renderHtml($value);

SafeEntities::render($value, ['&shy;', '&nbsp;']);
bash
php artisan vendor:publish --tag="safe-entities-config"
blade
<div>@entitiesHtml($entry->content)</div>