PHP code example of software-technologies-limited / stl-rich-text-editor

1. Go to this page and download the library: Download software-technologies-limited/stl-rich-text-editor 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/ */

    

software-technologies-limited / stl-rich-text-editor example snippets




use Stl\RichTextEditor\Assets;
use Stl\RichTextEditor\Editor;

$assets = new Assets();
$editor = new Editor(
    name: 'content',
    value: $savedHtml,
    preset: 'standard',
    options: ['placeholder' => 'Write something useful…'],
);

$editor = new Editor(
    name: 'body',
    preset: 'custom',
    options: ['toolbar' => ['bold', 'italic', '|', 'link', 'source']],
);

$editor = new Editor(
    name: 'body',
    preset: 'full',
    options: [
        'uploadUrl' => '/uploads/images',
        'uploadField' => 'image',
        'uploadHeaders' => ['X-CSRF-Token' => $csrfToken],
        'uploadData' => ['context' => 'articles'],
    ],
);

$editor = new \Stl\RichTextEditor\Editor(
    name: 'Post[content]',
    value: (string) $model->content,
    preset: 'full',
);

echo $editor->render();
echo $editor->script();