Download the PHP package ermilov/draft-php without Composer
On this page you can find all versions of the php package ermilov/draft-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ermilov/draft-php
More information about ermilov/draft-php
Files in ermilov/draft-php
Package draft-php
Short Description PHP implementation of Draft.js ContentState model to allow server-side handling of Draft.js produced content. PHP 5.6 downgraded version
License
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
php Version ^5.6