PHP code example of mati365 / ckeditor5-symfony
1. Go to this page and download the library: Download mati365/ckeditor5-symfony 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/ */
mati365 / ckeditor5-symfony example snippets
// config/bundles.php
return [
// ...
Mati365\CKEditor5Symfony\CKEditorBundle::class => ['all' => true],
];
use Mati365\CKEditor5Symfony\Preset\PresetParser;
class ArticleController extends AbstractController
{
#[Route('/article/edit')]
public function edit(): Response
{
return $this->render('article/edit.html.twig', [
'preset' => PresetParser::parse([
'editorType' => 'balloon',
'config' => [
'toolbar' => ['bold', 'italic', 'undo', 'redo'],
'plugins' => ['Essentials', 'Paragraph', 'Bold', 'Italic', 'Undo'],
],
]),
]);
}
}
use Mati365\CKEditor5Symfony\Form\Type\CKEditor5Type;
// ...
$builder->add('content', CKEditor5Type::class, [
'label' => 'Article Content',
'bash
php bin/console ckeditor5:assets-mapper:install # --editor-version 49.0.0 --premium --translations en,pl
bash
php bin/console ckeditor5:assets-mapper:install --distribution=cloud
bash
php bin/console ckeditor5:assets-mapper:install --translations=pl,de,fr
bash
php bin/console ckeditor5:assets-mapper:install --translations=pl,de,fr
twig
{# Paragraph-like balloon editor — ideal for image captions #}
{{ cke5_editor('Image caption', editor_type: 'balloon', model_element: '$inlineRoot') }}