ueberdosis/prosemirror-php

This package is abandoned and no longer maintained. No replacement package was suggested.

Work with ProseMirror JSON in PHP.

Package info

github.com/ueberdosis/prosemirror-php

pkg:composer/ueberdosis/prosemirror-php

Fund package maintenance!

ueberdosis/

Statistics

Installs: 76 565

Dependents: 0

Suggesters: 0

Stars: 14

0.3.0 2020-12-09 10:38 UTC

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 1fe48721782c3eb72e58e28d46121219c4fb58d9

  • Hans Pagel

prosemirror

This package is auto-updated.

Last update: 2022-02-27 21:49:02 UTC


README

🚨 We’ve done a rewrite that you probably want to check out: ueberdosis/tiptap-php

ProseMirror PHP

This package enables you to work with ProseMirror JSON in PHP. Convert it to HTML, or convert HTML to ProseMirror compatible JSON.

👁 Latest Version on Packagist
👁 Integrate
👁 Total Downloads
👁 Sponsor

Installation

composer require ueberdosis/prosemirror-php

Usage

Convert HTML to ProseMirror JSON:

(new \ProseMirror\ProseMirror)->html('<p>Example Text</p>')->toJson();

or

\ProseMirror\ProseMirror::htmlToJson('<p>Example Text</p>');

Output:

{
 "type": "doc",
 "content": [
 {
 "type": "paragraph",
 "content": [
 {
 "type": "text",
 "text": "Example Text"
 }
 ]
 }
 ]
}

Convert ProseMirror JSON to HTML:

(new \ProseMirror\ProseMirror)->json([
 'type' => 'doc',
 'content' => [
 [
 'type' => 'paragraph',
 'content' => [
 [
 'type' => 'text',
 'text' => 'Example Text',
 ],
 ],
 ],
 ],
])->toHtml();

or

\ProseMirror\ProseMirror::jsonToHtml([
 'type' => 'doc',
 'content' => [
 [
 'type' => 'paragraph',
 'content' => [
 [
 'type' => 'text',
 'text' => 'Example Text',
 ],
 ],
 ],
 ],
]);

Output:

<p>Example Text</p>

Contributing

Pull Requests are welcome.

Credits

Related Packages

License

The MIT License (MIT). Please see License File for more information.