- What Laravel versions does this package support?
- The package is designed for Laravel applications using Blade templates but does not explicitly state version compatibility. Verify your Laravel version aligns with the `blade-icons` package (which it extends) and test thoroughly, as the package itself lacks versioning details.
- How do I integrate this with existing icon libraries like Heroicons or Font Awesome?
- This package works with SVG-based icon sets processed by `blade-icons`. For libraries like Heroicons, ensure your icons are converted to SVGs first, then configure the `generation.php` file to handle attributes like `fill` or `stroke` for solid/outline variants. Custom attributes can be added via the `custom-attributes` config.
- Does this package support dynamic icon sizes or responsive icons?
- The package removes default `width` and `height` attributes during optimization, allowing you to control sizing via CSS or inline styles. Use the `custom-attributes` config to add classes like `w-4 h-4` or responsive classes dynamically in Blade templates.
- Can I use this in a Laravel Livewire or Inertia.js project?
- Yes, since this package works with Blade components, it integrates seamlessly with Livewire or Inertia.js projects that use Blade for server-side rendering. Icons generated via this helper can be reused in Livewire components or Inertia Blade partials without issues.
- What happens if the package fails to generate an icon? Does it have fallbacks?
- The package does not explicitly document fallback behavior, but since it processes SVGs via `blade-icons`, missing or malformed icons may result in broken components. Test edge cases (e.g., corrupted SVGs) and implement custom error handling in your Blade templates or `after` callback.
- How do I customize the SVG optimization process (e.g., keep certain attributes)?
- Use the `pre` and `post` callable methods in the `IconProcessor` to modify the `DOMDocument` instance before or after default processing. For example, override the `pre` method to preserve specific attributes like `aria-label` or add custom logic to handle dynamic theming.
- Is this package compatible with Laravel Blade caching? Will it break cached views?
- The package modifies SVGs during the `after` callback, which runs during icon generation (not at runtime). However, if you regenerate icons after caching Blade views, ensure your cache is invalidated or use config-based toggles to avoid inconsistencies between cached and dynamic icon outputs.
- Are there performance concerns with using this in production?
- The package performs lightweight SVG optimizations during generation, not at request time. Performance impact depends on the number of icons and complexity of the `after` callback logic. Profile the generation step in your CI/CD pipeline to ensure it doesn’t slow down deployments.
- How do I test this package in my CI/CD pipeline?
- Test by generating a subset of icons in a staging environment, then compare outputs (e.g., file sizes, attribute modifications) against your baseline. Use PHPUnit to mock the `after` callback and verify `IconProcessor` behavior, or manually inspect generated SVGs for correctness.
- What alternatives exist for Blade icon generation, and why choose this package?
- Alternatives include manual SVG handling, `blade-icons` alone, or libraries like Heroicons with Blade directives. This package adds optimization helpers (e.g., outline/solid variants, attribute stripping) on top of `blade-icons`, reducing manual work. Choose it if you need fine-grained control over SVG attributes or dynamic icon processing.