diff --git a/src/Icons/src/Iconify.php b/src/Icons/src/Iconify.php
index 564b87f2bd7..fcbebe81031 100644
--- a/src/Icons/src/Iconify.php
+++ b/src/Icons/src/Iconify.php
@@ -126,7 +126,12 @@ public function fetchIcons(string $prefix, array $names): array
$data = $response->toArray();
$icons = [];
- foreach ($data['icons'] as $iconName => $iconData) {
+ foreach ($names as $iconName) {
+ $iconData = $data['icons'][$data['aliases'][$iconName]['parent'] ?? $iconName] ?? null;
+ if (!$iconData) {
+ continue;
+ }
+
$height = $iconData['height'] ?? $data['height'] ??= $this->sets()[$prefix]['height'] ?? null;
$width = $iconData['width'] ?? $data['width'] ??= $this->sets()[$prefix]['width'] ?? null;
diff --git a/src/Icons/tests/Unit/IconifyTest.php b/src/Icons/tests/Unit/IconifyTest.php
index c6edef0cf3a..c57e37ccccb 100644
--- a/src/Icons/tests/Unit/IconifyTest.php
+++ b/src/Icons/tests/Unit/IconifyTest.php
@@ -190,7 +190,47 @@ public function testFetchIcons(): void
$icons = $iconify->fetchIcons('bi', ['heart', 'bar']);
$this->assertCount(2, $icons);
- $this->assertSame(['heart', 'bar'], array_keys($icons));
+ $this->assertSame(['bar', 'heart'], array_keys($icons));
+ $this->assertContainsOnlyInstancesOf(Icon::class, $icons);
+ }
+
+ public function testFetchIconsByAliases(): void
+ {
+ $iconify = new Iconify(
+ cache: new NullAdapter(),
+ endpoint: 'https://example.com',
+ http: new MockHttpClient([
+ new JsonMockResponse([
+ 'mdi' => [],
+ ]),
+ new JsonMockResponse([
+ 'aliases' => [
+ 'capsule' => [
+ 'parent' => 'pill',
+ ],
+ 'sign' => [
+ 'parent' => 'draw',
+ ],
+ ],
+ 'icons' => [
+ 'pill' => [
+ 'body' => '',
+ ],
+ 'glasses' => [
+ 'body' => '',
+ ],
+ 'draw' => [
+ 'body' => '',
+ ],
+ ],
+ ]),
+ ]),
+ );
+
+ $icons = $iconify->fetchIcons('mdi', ['capsule', 'sign', 'glasses']);
+
+ $this->assertCount(3, $icons);
+ $this->assertSame(['capsule', 'glasses', 'sign'], array_keys($icons));
$this->assertContainsOnlyInstancesOf(Icon::class, $icons);
}