diff --git a/readme.md b/readme.md index 3514c3e..26806d7 100644 --- a/readme.md +++ b/readme.md @@ -25,17 +25,58 @@ Inteve\Icons requires PHP 7.4.0 or later. This library is implementation of [PHIG's](https://github.com/phig-org/phig) `HtmlIcons` interface. + ### InlineSvgIcons ``` php -$icons = new \Inteve\Icons\InlineSvgIcons($iconsDirectory) +$icons = new \Inteve\Icons\InlineSvgIcons($iconsDirectory); echo $icons->get('my-icon'); // finds file "$iconsDirectory/my-icon.svg", prints ... ``` + ### ImgIcons +``` php +$icons = new \Inteve\Icons\ImgIcons($publicUrlPath, $fileExtension, $htmlClass = 'icon'); +echo $icons->get('my-icon'); // prints +echo $icons->get('my-icon@small'); // prints +``` + + +### InlineStyleIcons + +``` php +$icons = new \Inteve\Icons\InlineStyleIcons($publicUrlPath, $fileExtension, $htmlClass = 'icon', $tagName = 'i'); +echo $icons->get('my-icon'); // prints +echo $icons->get('my-icon@small'); // prints +``` + + +### WrappedIcons + +``` php +$svgIcons = new \Inteve\Icons\InlineSvgIcons($iconsDirectory); +$icons = new \Inteve\Icons\WrappedIcons($svgIcons, $className = 'icon', $tagName = 'i'); +echo $icons->get('my-icon'); // prints ... +echo $icons->get('my-icon@small'); // prints ... +``` +### PrefixedIcons + +``` php +$icons = new \Inteve\Icons\PrefixedIcons( + icons: [ + 'legacy' => new ImgIcons($publicUrlPath, $fileExtension), + 'bootstrap' => new \Inteve\Icons\InlineSvgIcons($bootstrapIconsDirectory), + ], + defaultIcons: new \Inteve\Icons\InlineSvgIcons($iconsDirectory) +); +echo $icons->get('my-icon'); // prints ... +echo $icons->get('legacy/my-icon'); // prints +echo $icons->get('bootstrap/my-icon'); // prints ... +``` + ------------------------------ License: [New BSD License](license.md)