Custom format for generation block structure on the different front-end system
- php >= 5.4
Install via composer
$ composer require mldberry/jms-format
Loading JMS format from HTML
<?php
$jsmFormat = new Mildberry\JMSFormat\JMSFormat();
print $jmsFormat->convert('html', 'jms', '<h1>Header</h1><p>text</p>');
Output:
{"version":"v1","content":[{"block":"headline","modifiers":{"weight":"lg"},"content":[{"block":"text","modifiers":[],"content":"Header"}]},{"block":"paragraph","modifiers":[],"content":[{"block":"text","modifiers":[],"content":"text"}]}]}
This library is under the MIT license. See the complete license in here