yassinedoghri / tempest-icons
A Tempest library providing a convenient `icon(…)` function for rendering SVG icons with php-icons.
dev-develop
2024-10-20 14:44 UTC
Requires
- php: >=8.3
- tempest/core: ^v1.0.0-alpha2
- yassinedoghri/php-icons: ^v1.1.0
Requires (Dev)
- pestphp/pest: ^v3.4.1
- pestphp/pest-plugin-type-coverage: ^v3.1.0
- phpstan/phpstan: ^1.12.7
- rector/rector: ^1.2.8
- symplify/coding-standard: ^12.2.3
- symplify/easy-coding-standard: ^12.3.6
This package is auto-updated.
Last update: 2024-10-20 14:44:41 UTC
README
Tempest Icons 🌊 🙂
A Tempest library providing a convenient icon(…)
function for rendering SVG icons with
php-icons.
🚀 Getting started
0. Prerequisites
Usage of Tempest Icons requires the following:
- A Tempest based project
- Composer for package management
- PHP 8.3+
1. Install via composer
composer require yassinedoghri/tempest-icons
2. Setup
Initialize and configure PHPIcons,
ie. create the php-icons.php
config file:
vendor/bin/php-icons init
3. Usage
Use the icon(string $iconKey, array $attributes)
function anywhere in your
View files to render SVG icons:
<?= icon('material-symbols:bolt') ?> // <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"> // <path fill="currentColor" d="m8 22l1-7H4l9-13h2l-1 8h6L10 22z"/> // </svg> <?= icon('material-symbols:bolt', ['class' => 'text-2xl', "style" => "color: yellow;"]) ?> // <svg class="text-2xl" style="color: yellow;" [...]>...</svg> <?= icon('material-symbols:bolt') ->attr('class', 'text-2xl') ->attr('style', 'color: yellow;') ?> // <svg class="text-2xl" style="color: yellow;" [...]>...</svg>
For more usage info, see php icons docs.
📜 License
Code released under the MIT License.
Copyright (c) 2024-present, Yassine Doghri (@yassinedoghri).