PHPackages                             enflow/laravel-svg - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. enflow/laravel-svg

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

enflow/laravel-svg
==================

Using SVGs with easy

3.5.0(2mo ago)657.1k↑43.4%1MITPHPPHP ^8.3CI passing

Since Mar 23Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/enflow/laravel-svg)[ Packagist](https://packagist.org/packages/enflow/laravel-svg)[ Fund](https://enflow.nl/contact)[ RSS](/packages/enflow-laravel-svg/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (25)Used By (0)

Using SVGs with easy
====================

[](#using-svgs-with-easy)

[![Latest Version on Packagist](https://camo.githubusercontent.com/752fd0be7b2550ea2d1b490dd38ad070149e6d8aebce5d95713181b7dd25cd2e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656e666c6f772f6c61726176656c2d7376672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/enflow/laravel-svg)[![GitHub Workflow Status](https://github.com/enflow-nl/laravel-svg/workflows/run-tests/badge.svg)](https://github.com/enflow-nl/laravel-svg/workflows/run-tests/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/be91d91e2b16bef860cffe7a72bcc07ecf7c2be9b72e5a6890fb64d0d426eff7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656e666c6f772f6c61726176656c2d7376672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/enflow/laravel-svg)

The `enflow/laravel-svg` package provides a easy way include SVGs in your templates.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require enflow/laravel-svg
```

Usage
-----

[](#usage)

You may use the `svg` helper in your templates

```
{{ svg('clock') }}

// Adding a class
{{ svg('clock')->class('mr-2') }}

// Adding an extra attribute
{{ svg('clock')->class('mr-2')->id('clock-icon') }}

// Specify the pack
{{ svg('clock')->pack('fas') }}
```

Config
------

[](#config)

You may publish the config to set the packs that you are using:

Pushing the config file:

```
php artisan vendor:publish --provider="Enflow\Svg\SvgServiceProvider"
```

Packs
-----

[](#packs)

You may specify multiple packs that are used in your application. By default, only the `resources/img/svgs` pack is included, but you may specify additional icon sets like Font Awesome in your config. When the pack isn't specified when including the SVG, the first one that can be found in the order defined in your config will be used. You may overrule this behavior by calling the `pack` method on the `Enflow\Svg\Svg` class that's returned by the SVG helper.

```
