marcw / weaver
A small library that weaves HTML together
dev-master
2015-04-06 09:05 UTC
Requires (Dev)
- phpunit/phpunit: ~4.5
- twig/twig: 1.*
This package is not auto-updated.
Last update: 2024-10-26 17:18:52 UTC
README
Weaves HTML blocks and fragments together.
<?php
$weaver = new \MarcW\Weaver\Weaver();
$body = '<p>foobar</p><p>barfoo</p>';
$fragments = ['<img src="/foobar.png" />'];
$result = $weaver->weave($body, $fragments);
// $results contains: <p>foobar</p><img src="/foobar.png" /><p>barfoo</p>
It's also possible to implicity tells the library where to weaves the HTML pieces.
<?php
$weaver = new \MarcW\Weaver\Weaver();
$body = '<p>foobar</p><p>barfoo</p>__WEAVE__';
$fragments = ['<img src="/foobar.png" />'];
$result = $weaver->weave($body, $fragments);
// $results contains: <p>foobar</p><p>barfoo</p><img src="/foobar.png" />
License and Copyright
See LICENSE file in this repository