- scandir: documentation ( source)
- strpos: documentation ( source)
- str_replace: documentation ( source)
<?php
// get all icons getSetByPrefix
$icons = [];
foreach (config('blade-icons.sets') as $key => $value) {
$icons[$key] = [];
$path = $value['path'];
$prefix = $value['prefix'];
$files = scandir($path);
foreach ($files as $file) {
if (strpos($file, '.svg') !== false) {
$name = str_replace('.svg', '', $file);
$icons[$key][] = $prefix . '-' . $name;
}
}
}