Download the PHP package prezly/draft-php without Composer
On this page you can find all versions of the php package prezly/draft-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download prezly/draft-php
More information about prezly/draft-php
Files in prezly/draft-php
Package draft-php
Short Description PHP implementation of Draft.js ContentState model to allow server-side handling of Draft.js produced content.
License MIT
Informations about the package draft-php
Prezly's Draft-PHP
PHP implementation of Draft.js ContentState model to allow server-side handling of Draft.js produced content.
Table of contents
- Usage
- Reading ContentState JSON
- Serializing ContentState back to JSON
- Notes on implementation
- Other implementations
- License
- Credits
Usage
Reading ContentState JSON
Serializing ContentState back to JSON
Notes on implementation
-
ContentState now holds an
$entityMap
property and has->getEntity(string $entityKey)
method. This approach allows to incapsulate all the data coming from JSON into a single object and then use it for rendering.Having global static pool of entities (as in native Draft.js implementation, and another PHP port of Draft.js model) is not that useful. Global state gets into your way when you need to render multiple content states in a single PHP process. Also it complicates testing.
- All the model classes are immutable. That's achived by storing all the data in private properies
providing getters only as public API (
getXxxx
methods + magic__get()
method to emulate read-only public props).
Other implementations
- webstronauts/draft-php — a one-to-one port of Draft.js model specs, well tested
License
MIT
Credits
Built with :metal: by Prezly — CRM software crafted for PR communication
All versions of draft-php with dependencies
ext-json Version *
ext-mbstring Version *