PHPackages                             thezenmonkey/silverstripe-svgspritefield - 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. [Image &amp; Media](/categories/media)
4. /
5. thezenmonkey/silverstripe-svgspritefield

ActiveSilverstripe-vendormodule[Image &amp; Media](/categories/media)

thezenmonkey/silverstripe-svgspritefield
========================================

A module add SVGSprites to Silverstripe

226PHP

Since Sep 7Pushed 7y ago1 watchersCompare

[ Source](https://github.com/thezenmonkey/SVGSpriteField)[ Packagist](https://packagist.org/packages/thezenmonkey/silverstripe-svgspritefield)[ RSS](/packages/thezenmonkey-silverstripe-svgspritefield/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

SVGSpriteField
==============

[](#svgspritefield)

This module lets you assign icons to a DataObject using [SVG Sprites](https://css-tricks.com/svg-sprites-use-better-icon-fonts/). It can be configured to use a default sprite file or a custom sprite file can be on a per-field basis. This module is heavily based on [jaedb/IconField](https://github.com/jaedb/IconField) and if you need a solution that used multiple image files for icons you should use th one.

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

[](#requirements)

SilverStripe CMS ^4.2 Silverstripe SVG ^2 (for inlining Sprites)

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

[](#installation)

```
composer require thezenmonkey/silverstripe-svgspritefield

```

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

[](#configuration)

The Sprite field is a subclass of OptionSetField and takes the same parameters with a SVG Sprite File being used as the source array.

Usage
-----

[](#usage)

- Set your $db field to type Icon (eg 'Icon' =&gt; Sprite::class)
- `SpriteField::create($name, $title, $iconFolder)`
    - *$name* is the database field as defined in your class
    - *$title* is the label for this field
    - *$sourceFile* (optional) defines SVG Sprite file with Icons.

### Setting Up Sprites

[](#setting-up-sprites)

The module will use the `symbol` as the value stored in your database. The `` provides the Name od the Icon.

### Templates

[](#templates)

To use in you theme use the stndard SVG use markup with *$Value* as the name of your DataBase field

```

```

Ensure you include the SVG source file somewhere on the page set to display none

```
{$SVG('mysource.svg').customBasePath('my/base/path').extraClass('myhiddenclass')}
```

Please see [SilverStripe SVG](https://github.com/stevie-mayhew/silverstripe-svg) for correct implementation.

Acknowledgments
---------------

[](#acknowledgments)

- [jaedb/IconField](https://github.com/jaedb/IconField)
- [CSS Tricks](https://css-tricks.com/svg-sprites-use-better-icon-fonts/)
- [SilverStripe SVG](https://github.com/stevie-mayhew/silverstripe-svg)

ToDo
----

[](#todo)

- More Configuration Options
- Built-in Template
- Built in inclusion of SpriteFile on page

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/edcb58d638f0b809f943935c9b9dc3dd7de6556d624a3e1e025cff8a03c1b6be?d=identicon)[thezenmonkey](/maintainers/thezenmonkey)

---

Top Contributors

[![thezenmonkey](https://avatars.githubusercontent.com/u/1685217?v=4)](https://github.com/thezenmonkey "thezenmonkey (6 commits)")

### Embed Badge

![Health badge](/badges/thezenmonkey-silverstripe-svgspritefield/health.svg)

```
[![Health](https://phpackages.com/badges/thezenmonkey-silverstripe-svgspritefield/health.svg)](https://phpackages.com/packages/thezenmonkey-silverstripe-svgspritefield)
```

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

133890.0k3](/packages/goat1000-svggraph)[imagekit/imagekit

PHP library for Imagekit

46877.3k10](/packages/imagekit-imagekit)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

12644.1k2](/packages/gravatarphp-gravatar)

PHPackages © 2026

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