lostlink / laravel-editorjs
A simple editor.js html parser for Laravel with Tailwind styling
dev-main
2023-01-23 15:42 UTC
Requires
- php: ^7.4|^8
- codex-team/editor.js: dev-master
- illuminate/support: ^6|^7|^8|^9
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-10-23 19:39:50 UTC
README
Laravel-Editor.js
A simple editor.js html parser for Laravel with Tailwind styling
Installation
You can install the package via composer:
composer require lostlink/laravel-editorjs
You can publish the config file with:
php artisan vendor:publish --tag="laravel_editorjs-config"
Optionally, you can publish the views using
php artisan vendor:publish --tag="laravel_editorjs-views"
Usage
use App\Models\Post; $post = Post::find(1); echo LaravelEditorJs::render($post->body);
Defining An Accessor
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Lostlink\LaravelEditorJs\Facades\LaravelEditorJs; class Post extends Model { public function getBodyAttribute() { return LaravelEditorJs::render($this->attributes['body']); } } $post = Post::find(1); echo $post->body;
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.