jamesbwi / blade-svg
Embed SVGs in Laravel Blade.
Requires
- php: ^7.4|^8.0
- illuminate/support: ^8.0|^9.0|^10.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-05-27 15:29:13 UTC
README
This package allows for easy use and manipulation of svg files within your laravel project.
Installation
You can install the package via composer:
composer require jamesbwi/blade-svg
Usage
To insert an SVG file, simply use the following component:
<x-blade-svg src="img/apple.svg"/>
You can pass any attribute into the component as if it were an inline svg:
<x-blade-svg src="img/apple.svg" class="apple-animation" viewBox="0 0 50 100"/>
<use> tags
If you wish to utilise the SVG <use> tags this package simplifies the process.
The following component will embed the SVG into an <element> tag with the specified attributes:
<x-blade-svg-def id="apple" src="img/apple.svg" viewBox="0 0 50 100"/>
The element (or any other SVG with an id) can then be referenced with the following tag:
<x-blade-svg-use href="#apple"/>
You can add any attribute to the <use> tag:
<x-blade-svg-use href="#apple" class="apple-animation" width="500px" preserveAspectRatio="none"/>
External sources can be referenced too:
<x-blade-svg-use href="fruit-bowl.svg#pear"/>
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email james@wearebwi.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.