burntcaramel / icing
Display and customize structured icing content.
1.0.0-beta5
2015-04-15 09:52 UTC
Requires
- php: >=5.3.0
- burntcaramel/glaze: 2.0.*
This package is not auto-updated.
Last update: 2024-12-25 09:56:13 UTC
README
PHP library for viewing Icing files. Read more about Icing here.
Example
You just need a .icing file with your content, and a specs .json file that determines how the content is displayed.
use BurntIcing\Specs;
use BurntIcing\HTMLTransformer;
$specsJSON = json_decode(file_get_contents(__DIR__. '/specs.json'), true);
$contentJSON = json_decode(file_get_contents(__DIR__. '/content.icing'), true);
$specs = new Specs($specsJSON);
$HTMLTransformer = HTMLTransformer::newTransformerWithSpecs($specs);
$HTMLTransformer->displayHTMLFromContentJSON($contentJSON);
Extensible
PHP
Subclass BlockHandler
, TraitHandler
, or SubsectionHandler
to customise the content as it is being displayed.
This is how my Blik page is displayed, with iTunes links and images interweaved in PHP on the server.
Specs JSON files
The structure is still in flux, but specs .json files allow custom block and traits to be added, with fields that get transformed into HTML. These will be handled both with this PHP library and with the React.js based Icing Editor.
Test Output
php -f tests/test.php