Installation
The repository ships two packages, released from the same git tag.
| Package | Registry | What it does |
|---|---|---|
silarhi/ux-icons-js-bundle |
Packagist | Dumps your local icons, with their configured attributes, as a JavaScript module. |
@silarhi/ux-icons-js |
npm | Renders the dumped icons in vanilla JavaScript, React or Vue, like ux_icon() does. |
Requirements
Section titled “Requirements”| Dependency | Version |
|---|---|
| PHP | 8.2+ |
| Symfony | 6.4 / 7.x / 8.x |
symfony/ux-icons |
2.36.1+ / 3.5+ |
React (optional peer dependency, for @silarhi/ux-icons-js/react) |
18 / 19 |
Vue (optional peer dependency, for @silarhi/ux-icons-js/vue) |
3 |
symfony/ux-icons 3 needs PHP 8.4. On symfony/ux-icons 2.x, ux:icons:lock does not find the icons imported in
JavaScript, and boolean attributes follow the 3.x rules: see compatibility.
composer require silarhi/ux-icons-js-bundleRegister the bundle after UXIconsBundle, whose configuration it reuses:
return [ // ... Symfony\UX\Icons\UXIconsBundle::class => ['all' => true], Silarhi\UxIconsJsBundle\SilarhiUxIconsJsBundle::class => ['all' => true],];No configuration is needed: the icons are dumped into var/icons/ on the next cache warmup. See the
configuration reference to change it.
JavaScript
Section titled “JavaScript”pnpm add @silarhi/ux-icons-jsWith AssetMapper, add it to the import map instead (with the React or Vue entry point if you use it):
php bin/console importmap:require @silarhi/ux-icons-js @silarhi/ux-icons-js/reactThe package is an ES module with its TypeScript declarations. Continue with the quick start.
