radmen / custom-tag-parser
Simple parser for custom tags
dev-master
2013-05-13 13:01 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-12-14 04:34:19 UTC
README
-
Install Composer
-
Add
radmen/custom-tag-parser
to your project's `composer.json:
{ "require": { "radmen/custom-tag-parser": "dev-master" } }
- Install/update your dependencies
Example
<?php $parser = new CustomTagParser\Parser('<fizz i="3"> <fizz i="5" /> <fizz i="15">'); foreach($parser->tags('fizz') as $tag) { if(0 == $tag->i % 15) { $tag->replaceWith('FooBar'); } else if(0 == $tag->i % 5) { $tag->replaceWith('Bar'); } else if(0 == $tag->i % 3) { $tag->replaceWith('Foo'); } } $parser->toString(); // Foo Bar FooBar