PHPackages                             sideshot/php-svg-icons - 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. sideshot/php-svg-icons

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

sideshot/php-svg-icons
======================

PHP package for Lucide SVG icons with easy attribute injection

v1.0.3(10mo ago)016MITPHPPHP &gt;=8.0

Since Jul 8Pushed 10mo agoCompare

[ Source](https://github.com/sideshot/php-svg-icons)[ Packagist](https://packagist.org/packages/sideshot/php-svg-icons)[ Docs](https://github.com/sideshot/php-svg-icons)[ RSS](/packages/sideshot-php-svg-icons/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

PHP SVG Icons
=============

[](#php-svg-icons)

A simple PHP package for using Lucide SVG icons with easy attribute injection, styling, and accessibility.

> **Note:** This package is focused on the [Lucide](https://lucide.dev/) icon set. If you want to support other SVG icon sets, you can replicate the pattern in your own class or extend this one.

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

[](#installation)

```
composer require sideshot/php-svg-icons
```

Package Size
------------

[](#package-size)

- Includes **~1300+ Lucide SVG icons**
- Approximate disk usage after install: **2–3MB**
- All icons are stored locally in the package for fast, offline access

Usage
-----

[](#usage)

```
use Sideshot\PhpSvgIcons\Icon;

$icon = new Icon();

// Basic usage
echo $icon->lucide('arrow-up');

// With CSS classes
echo $icon->lucide('heart', 'w-6 h-6 text-red-500');

// With custom attributes
echo $icon->lucide('star', 'w-5 h-5', attributes: [
    'stroke-width' => '2',
    'fill' => 'currentColor'
]);

// With accessible label (auto-sets role, aria-label, aria-hidden)
echo $icon->lucide('plus', 'w-4 h-4', label: 'Add item');

// Named arguments for clarity
echo $icon->lucide(
    name: 'check-circle',
    classes: 'w-5 h-5 text-green-500',
    label: 'Success'
);
```

Features
--------

[](#features)

- **Automatic download**: Lucide icons are automatically downloaded during package installation
- **Flexible attributes**: Add any SVG attributes (stroke-width, fill, etc.)
- **CSS classes**: Easy styling with Tailwind or custom classes
- **Accessibility**: Use the `label` parameter for accessible icons, or default to decorative
- **Error handling**: Returns empty string if icon doesn't exist
- **Extensible**: You can add support for other SVG icon sets by replicating the class/method pattern for your own needs

Accessibility Guidelines
------------------------

[](#accessibility-guidelines)

### The `label` Parameter

[](#the-label-parameter)

- If you provide `label`, the icon will have `role="img"`, `aria-label`, and `aria-hidden="false"` automatically set (unless you override them in `attributes`).
- If you do **not** provide `label`, the icon will default to `aria-hidden="true"` (decorative, hidden from assistive tech).
- You can always override any ARIA attribute by passing it in `attributes`.

### When to Use `label`

[](#when-to-use-label)

- Use `label` when the icon conveys meaning not present in surrounding text (e.g., a standalone plus icon for "Add item").
- Do **not** use `label` if the icon is purely decorative or the meaning is clear from adjacent text (e.g., an icon next to "Buy Now").

### Examples

[](#examples)

```
// Decorative icon (default - hidden from screen readers)
echo $icon->lucide('arrow-right', 'w-4 h-4');

// Informative icon (announced as "Add item")
echo $icon->lucide('plus', 'w-4 h-4', label: 'Add item');

// Icon with text (icon is decorative)
echo $icon->lucide('plus', 'w-4 h-4', ['aria-hidden' => 'true']);
echo 'Add item';

// Override ARIA attributes manually
echo $icon->lucide('info', 'w-4 h-4', attributes: [
    'aria-label' => 'Information',
    'role' => 'img',
    'aria-hidden' => 'false'
]);
```

### Best Practices

[](#best-practices)

- **Be descriptive**: Use `label` to provide context when needed
- **Keep it concise**: Avoid redundant text
- **Test with screen readers**: Ensure your ARIA labels make sense

Available Icons
---------------

[](#available-icons)

All [Lucide icons](https://lucide.dev/icons/) are available. Just use the icon name:

- `arrow-up`
- `heart`
- `star`
- `home`
- `user`
- And 1300+ more...

License
-------

[](#license)

MIT License - see [LICENSE](LICENSE) file for details.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance54

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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

Every ~0 days

Total

3

Last Release

313d ago

PHP version history (2 changes)v1.0.1PHP &gt;=7.4

v1.0.2PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

phpiconssvglucide

### Embed Badge

![Health badge](/badges/sideshot-php-svg-icons/health.svg)

```
[![Health](https://phpackages.com/badges/sideshot-php-svg-icons/health.svg)](https://phpackages.com/packages/sideshot-php-svg-icons)
```

###  Alternatives

[twbs/bootstrap-icons

Official open source SVG icon library for Bootstrap

7.9k2.0M56](/packages/twbs-bootstrap-icons)[loganmarchione/homelab-svg-assets

Full-color SVG icons of homelab-related software, products, and brands

1.2k1.6k](/packages/loganmarchione-homelab-svg-assets)[tomloprod/radiance

A deterministic mesh gradient avatar generator for PHP.

1393.7k](/packages/tomloprod-radiance)[codewithdennis/filament-lucide-icons

A Filament plugin that integrates Lucide icons, allowing you to use them seamlessly across Filament forms, tables, actions, and more.

4529.4k2](/packages/codewithdennis-filament-lucide-icons)[fortawesome/wordpress-fontawesome

Official Font Awesome WordPress plugin composer package.

662.1k](/packages/fortawesome-wordpress-fontawesome)

PHPackages © 2026

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