# Migrating from PHP (oxblade-icons)

> This page lists each blade-ui-kit/blade-icons call and its Rust equivalent, for code moving from PHP.

- Package: oxblade-icons (Rust, alpha), crates: `oxblade-icons`
- Maintenance: active; Latest release: 0.1.0 (2026-12-05); MSRV: Rust 1.99 or later; Licence: MIT
- Links: [Repository](https://github.com/bowerbird-si/oxblade-icons), [crates.io](https://crates.io/crates/oxblade-icons/0.1.0), [docs.rs](https://docs.rs/oxblade-icons/0.1.0), [Changelog](https://oss.bowerbird.si/oxblade-icons/docs/changelog/), [Contributing](https://github.com/bowerbird-si/oxblade-icons/blob/c7e0252d5f06a12c2c4687fa63a4aa97d51b0e4c/CONTRIBUTING.md), [Security policy](https://github.com/bowerbird-si/oxblade-icons/blob/c7e0252d5f06a12c2c4687fa63a4aa97d51b0e4c/SECURITY.md)
- Based on: [blade-ui-kit/blade-icons](https://github.com/driesvints/blade-icons): The PHP renderer and template behavior this package ports.
- PHP parity: core (4 covered, 4 diverged, 3 planned of 11 abilities; 14 fixtures; follows blade-ui-kit/blade-icons 1.11.0; verified 2026-12-05)
- HTML version: https://oss.bowerbird.si/oxblade-icons/docs/migrating-from-php/
- Source: https://github.com/bowerbird-si/oxblade-icons/blob/c7e0252d5f06a12c2c4687fa63a4aa97d51b0e4c/docs/migrating-from-php.md

This page lists each blade-ui-kit/blade-icons call and its Rust equivalent, for code moving from PHP.

## Calls

| PHP | Rust |
| --- | --- |
| `svg('heroicon-o-home')` | `icons.icon("heroicon-o-home")?` |
| `svg('heroicon-o-home', 'size-6')` | `icons.svg("heroicon-o-home", "size-6", Attributes::new())?` |
| `svg('heroicon-o-home', ['width' => 24])` | `icons.svg_with("heroicon-o-home", Attributes::new().set("width", 24))?` |
| `svg('heroicon-o-home', 'size-6', ['width' => 24])` | `icons.svg("heroicon-o-home", "size-6", Attributes::new().set("width", 24))?` |
| `['x-cloak']` (value without a key) | `Attributes::new().flag("x-cloak")` |
| `->toHtml()` | `.to_html()` |
| `->strokeWidth(2)` | `.attr("stroke-width", 2)?` |
| `->name()`, `->contents()`, `->attributes()` | `.name()`, `.contents()`, `.attributes()` |
| `app(Factory::class)->all()` | `icons.sets()` |
| `app(Factory::class)->add('name', [...])` | `Icons::builder().set(IconSet::from_static(...))` |

## Templates

| PHP Blade | oxblade |
| --- | --- |
| `{{ svg('heroicon-o-home', 'size-6') }}` | the same |
| `@svg('heroicon-o-home', 'size-6')` | the same |
| `<x-icon name="heroicon-o-home" class="size-6" />` | the same |
| `<x-heroicon-o-home class="size-6" />` | the same |
| `<x-heroicon-o-home defer />` | not supported (`Error::Deferred`) |

See [Blade templates](https://oss.bowerbird.si/oxblade-icons/docs/blade/) to register them.

## Configuration

| PHP `config/blade-icons.php` | Rust |
| --- | --- |
| `sets.heroicons.path` | `.set(icon_set!(oxblade_heroicons))` or `IconSet::from_static` |
| `sets.default.path = 'resources/svg'` | a set named `default` (see [Icon sets](https://oss.bowerbird.si/oxblade-icons/docs/icon-sets/#the-default-set)) |
| `sets.*.prefix` | the second argument of `IconSet::from_static` / `from_lookup` |
| `sets.*.class`, `attributes`, `fallback` | `IconSet::class`, `attributes`, `fallback`, or `SetConfig` |
| `class`, `attributes`, `fallback` | `IconsBuilder::class`, `attributes`, `fallback`, or `IconsConfig` |
| `components.default` | `blade::Options::icon_component(Some("…"))` |
| `components.disabled = true` | `Options::new().set_components(false)` |
| `php artisan icons:cache`, `icons:clear` | not needed; sets are compiled in |

The installation package for a set, such as `blade-ui-kit/blade-heroicons`, becomes a data crate such as
`oxblade-heroicons` from [oxblade-icon-sets](https://github.com/bowerbird-si/oxblade-icon-sets).

## Behaviour to check

- A `title` from a plain string is escaped inside `<title>`; use `Trusted(...)` for PHP's exact output.
- `to_html()` doesn't add a second title when called twice.
- Attribute names starting with `on` are rejected.
- Fallbacks must exist when the registry is built.

The README's [Differences from PHP](https://github.com/bowerbird-si/oxblade-icons#differences-from-php)
section lists each difference with its reason.
