LaravelPackages.net
Acme Inc.
Toggle sidebar
jamesbwi/blade-svg

Embed SVGs in Laravel Blade.

916
1
0.1.5
About jamesbwi/blade-svg

jamesbwi/blade-svg is a Laravel package for embed svgs in laravel blade.. It currently has 1 GitHub stars and 916 downloads on Packagist (latest version 0.1.5). Install it with composer require jamesbwi/blade-svg. Discover more Laravel packages by jamesbwi or browse all Laravel packages to compare alternatives.

Last updated

Laravel Blade SVGs

Latest Version on Packagist Total Downloads

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 [email protected] 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.

Comments