marcw / weaver
A small library that weaves HTML together
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/marcw/weaver
Requires (Dev)
- phpunit/phpunit: ~4.5
- twig/twig: 1.*
This package is not auto-updated.
Last update: 2025-10-11 22:09:27 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