PHPackages                             bypickering/laravel-svgaware - 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. bypickering/laravel-svgaware

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

bypickering/laravel-svgaware
============================

SVGAware simplifies SVG management in Laravel applications by eliminating duplicated markup and removing the need to edit complex SVG code directly.

v1.0.0(2mo ago)113MITPHPPHP ^8.1

Since Mar 4Pushed 2mo agoCompare

[ Source](https://github.com/byPickering/laravel-svgaware)[ Packagist](https://packagist.org/packages/bypickering/laravel-svgaware)[ RSS](/packages/bypickering-laravel-svgaware/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

[![SVGAware Logo White](./SVGAware-cover.png)](./SVGAware-cover.png)

[![PHP Version](https://camo.githubusercontent.com/d6aac44f81cb2e6f4e71f098a1cb4a71992f24f7bfb424f6670db8313c9a855c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e312d626c7565)](https://camo.githubusercontent.com/d6aac44f81cb2e6f4e71f098a1cb4a71992f24f7bfb424f6670db8313c9a855c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e312d626c7565)[![Laravel Version](https://camo.githubusercontent.com/ad335721ef7600cceae9f04aa5f841e84a403a2a66278b5f875fcbc28ca108d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d25354531302d726564)](https://camo.githubusercontent.com/ad335721ef7600cceae9f04aa5f841e84a403a2a66278b5f875fcbc28ca108d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d25354531302d726564)[![License](https://camo.githubusercontent.com/70e2ddb1e361746cbab2a6ef771cde93b2fcde42846c09012f774920a224ebb3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d7768697465)](https://camo.githubusercontent.com/70e2ddb1e361746cbab2a6ef771cde93b2fcde42846c09012f774920a224ebb3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d7768697465)[![Version](https://camo.githubusercontent.com/1aae4bbb2f78ca33effee230a4e2667b68bb4beed10b9ecf6060c3999b063099/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f56657273696f6e2d312e302e302d677265656e)](https://camo.githubusercontent.com/1aae4bbb2f78ca33effee230a4e2667b68bb4beed10b9ecf6060c3999b063099/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f56657273696f6e2d312e302e302d677265656e)[![LinkedIn](https://camo.githubusercontent.com/c6598d90f92614f1e4a07d207e34b613e48dd0b67ee37fbb22756bab9f6cb85a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c696e6b6564496e2d526f6d656f2532305069636b6572696e672d626c75653f7374796c653d666c6174266c6f676f3d6c696e6b6564696e)](https://camo.githubusercontent.com/c6598d90f92614f1e4a07d207e34b613e48dd0b67ee37fbb22756bab9f6cb85a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c696e6b6564496e2d526f6d656f2532305069636b6572696e672d626c75653f7374796c653d666c6174266c6f676f3d6c696e6b6564696e)

SVGAware simplifies SVG management in Laravel applications by eliminating duplicated markup and removing the need to edit complex SVG code directly.

It allows you to render SVGs through Blade components, directives, or a Facade — with full Tailwind CSS styling support.

Install
-------

[](#install)

Install via Composer:

```
composer require bypickering/laravel-svgaware
```

To publish the available config and add items to the purge list:

```
php artisan vendor:publish --tag=svgaware-config
```

Getting Started
---------------

[](#getting-started)

Place your .svg files inside:

```
${projectRoot}/resources/svg
```

You can change this location using the SVGAWARE\_ROOT variable in your .env file.

Usage
-----

[](#usage)

### Blade Component

[](#blade-component)

SVGAware provides a Blade component:

```

```

You do not need to include the .svg extension. The extension is automatically appended using the `SVGAWARE_APPEND` configuration value.

### Blade Directive

[](#blade-directive)

You can use the directive instead:

```
@svg(icon-name)
```

### Facade

[](#facade)

If you are not using Blade components, a `SvgAwareFacade` is also available.

```
use Pickering\SVGAware\Facades\SvgAwareFacade;

$svgHTML = Svg::render('icon_name');
```

Dynamic Tags
------------

[](#dynamic-tags)

SVGAware allows you to define placeholder tags inside your SVG files. This allows you to pass arbitrary values into a specific location in the SVG document.

```

    {tag_name_1}

    {tag_name_2}

```

You may not include spaces when defining tags:

```
✅: {tag_name}
❌: { tag_name }
```

### Used In Blade Component

[](#used-in-blade-component)

```

```

### Used In Directive

[](#used-in-directive)

```
@svg(icon-name, ['tag_name' => 'Some Value'])
```

### Used In Facade

[](#used-in-facade)

```
// With attributes and tags
$svgHTML = SvgAwareFacade::render('icon_name', [
    'class' => 'h-5 w-5 text-blue-500',
    'tag_name' => 'dynamic_value'
]);
```

Attribute Forwarding
--------------------

[](#attribute-forwarding)

SVGAware will forward attributes and inject them into the root svg element allowing you the flexibility to add any attributes you need.

> Take note when naming your dynamic tags. If you pass a name that does not match a dynamic tag it will be injected as an attribute in the svg element.

```
$svgHTML = SvgAwareFacade::render('icon_name', [
    'id' => "svg_id",
    'class' => 'h-5 w-5 text-blue-500',
    'fill' => "fill-blue-500",
    'stroke' => "stroke-green-500",
    'tag_name' => 'dynamic_value',
]);
```

Purge Behavior
--------------

[](#purge-behavior)

SVGAware automatically cleans SVG attributes to make them easier to style — especially when using Tailwind CSS.

By default, the following attributes are removed from the root `` element:

- width
- height
- fill

You can customize this list inside: `config/svgaware.php` by modifying the `purge_list` array.

Root Directory
--------------

[](#root-directory)

The root directory defines where SVGAware looks for SVG files.

By default, it is set to `${projectRoot}/resources/svg`, and you can change it using:

- .env → SVGAWARE\_ROOT
- config/svgaware.php → root

Configuration
-------------

[](#configuration)

### Environment Variables

[](#environment-variables)

NameDefaultDescription`SVGAWARE_ROOT``${projectRoot}/resources/svg`Root directory where SVG files are stored.`SVGAWARE_COMPONENT``svg`Name of the Blade component used to render SVGs.`SVGAWARE_DIRECTIVE``svg`Name of the Blade directive used to render SVGs.`SVGAWARE_APPEND``.svg`String appended to SVG names when resolving files (e.g., `icon` → `icon.svg`).`SVGAWARE_PREPEND``""`String prepended to SVG names when resolving files.`SVGAWARE_PURGE``true`Determines whether SVG cleanup functionality runs automatically.### Config File

[](#config-file)

Located at: `config/svgaware.php` and maps all `.env` variables and defines the `purge_list`.

The `purge_list` is the list of attributes that will be deleted from the root `svg tag`.

```
return [
    'root'       => env('SVGAWARE_ROOT', resource_path('svg')),
    'component'  => env('SVGAWARE_COMPONENT', 'svg'),
    'directive'  => env('SVGAWARE_DIRECTIVE', 'svg'),
    'append'     => env('SVGAWARE_APPEND', '.svg'),
    'prepend'    => env('SVGAWARE_PREPEND', ''),
    'purge'      => env('SVGAWARE_PURGE', true),
    'purge_list' => ['width', 'height', 'fill'],
];
```

Requirements
------------

[](#requirements)

SVGAware requires:

- PHP 8.1 or higher
- Laravel 10 or higher

License
-------

[](#license)

SVGAware is open-sourced software licensed under the MIT license.

© 2026 Pickering

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software.

See the LICENSE file for the full license text.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance86

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

69d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b5b8f96ec6db28aac3eed37346fd9392c2bb7a04324e404db23bec26f5057ab?d=identicon)[theoromeo](/maintainers/theoromeo)

---

Top Contributors

[![byPickering](https://avatars.githubusercontent.com/u/8402427?v=4)](https://github.com/byPickering "byPickering (17 commits)")

---

Tags

content-management-systemfrontendlaravellaravel-frameworklaravel-packagesvgtoolui-componentsweb

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/bypickering-laravel-svgaware/health.svg)

```
[![Health](https://phpackages.com/badges/bypickering-laravel-svgaware/health.svg)](https://phpackages.com/packages/bypickering-laravel-svgaware)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
