Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Blade Heroicons Laravel Package

blade-ui-kit/blade-heroicons

Use Heroicons in Laravel Blade via simple SVG components. Supports passing classes/attributes, configuration through Blade Icons (defaults, caching), and works with PHP 8+ and Laravel 9+. Browse icons in the bundled SVGs or on heroicons.com.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Pros:

    • Blade Integration: Seamlessly integrates with Laravel’s Blade templating engine, leveraging Laravel’s component-based architecture. This aligns well with modern Laravel applications that use Blade for UI rendering.
    • SVG-Based Icons: Uses SVG icons (Heroicons), which are scalable, lightweight, and resolution-independent—ideal for modern web applications.
    • Component-Based: Encapsulates icons as reusable Blade components (<x-heroicon-o-arrow-left/>), promoting clean, modular, and maintainable UI code.
    • Extensibility: Built on top of Blade Icons, offering additional features like caching, default classes, and attributes, which can be configured via a published config file.
    • Consistency: Standardizes icon usage across the application, reducing inconsistencies in icon styling and behavior.
  • Cons:

    • Tight Coupling to Blade: Primarily designed for Blade templates. If the application uses other templating engines (e.g., Inertia.js with Vue/React), integration may require additional abstraction layers.
    • Dependency on Blade Icons: Relies on Blade Icons for core functionality, which could introduce additional complexity or potential conflicts if Blade Icons is updated independently.

Integration Feasibility

  • Low Effort for Basic Use:

    • Installation is straightforward (composer require blade-ui-kit/blade-heroicons), and basic usage (e.g., <x-heroicon-o-arrow-left/>) requires minimal changes to existing Blade templates.
    • No database migrations or complex setup are required.
  • Advanced Customization:

    • Publishing the config file (php artisan vendor:publish --tag=blade-heroicons-config) enables global defaults (e.g., default classes, attributes) for all icons, which can reduce boilerplate in templates.
    • Publishing raw SVG assets (php artisan vendor:publish --tag=blade-heroicons --force) allows for direct use of SVG files in non-Blade contexts (e.g., JavaScript or CSS).
  • Compatibility:

    • Supports Laravel 9+ and PHP 8.0+, making it compatible with most modern Laravel applications.
    • Works with Heroicons v2.x, which includes a comprehensive set of icons (outline, solid, mini, and micro variants).

Technical Risk

  • Minimal Risk for Basic Adoption:

    • The package is well-tested (CI/CD pipelines for tests and coding standards) and has a mature changelog, indicating stability.
    • MIT license allows for easy adoption without legal concerns.
  • Potential Risks:

    • Blade-Specific: If the application relies heavily on non-Blade templating (e.g., Inertia.js with React/Vue), the package may not provide direct benefits. However, raw SVG assets can still be used.
    • Dependency Updates: Since the package depends on Blade Icons and Heroicons, updates to these dependencies could introduce breaking changes. The changelog shows a history of updates, but major version bumps (e.g., Heroicons v2 → v3) could require migration effort.
    • Performance Impact: While SVG icons are lightweight, rendering hundreds of icons dynamically could impact performance. However, Blade Icons supports caching, mitigating this risk.
    • Customization Overhead: Advanced customization (e.g., global defaults, icon caching) requires publishing config files and understanding Blade Icons’ features.

Key Questions for Evaluation

  1. Templating Strategy:

    • Does the application primarily use Blade for UI rendering, or is there a reliance on other templating engines (e.g., Inertia.js, Livewire)?
    • If using Inertia.js, how will icons be consumed in React/Vue components? (Raw SVGs or Blade components?)
  2. Icon Usage Scope:

    • Will icons be used sparingly (e.g., a few buttons) or extensively (e.g., across all components)?
    • Are there specific icon variants (outline, solid, mini, micro) that are prioritized?
  3. Customization Needs:

    • Are global defaults (e.g., default classes, attributes) needed for all icons, or will icons be styled inline per usage?
    • Is icon caching required for performance optimization?
  4. Dependency Management:

    • How is the team’s policy on third-party dependencies? Are there concerns about maintaining Blade Icons and Heroicons compatibility?
    • Is there a process for testing updates to this package in a staging environment?
  5. Design System Alignment:

    • Does the application have a design system that dictates icon usage (e.g., specific sizes, colors, or variants)?
    • How will this package integrate with existing iconography (e.g., will it replace or supplement current icons)?
  6. Performance Considerations:

    • Are there concerns about the performance impact of dynamically rendering SVG icons at scale?
    • Will icon caching be enabled to mitigate potential performance issues?
  7. Future-Proofing:

    • Are there plans to migrate to a different UI framework (e.g., Livewire, Inertia.js) that might change how icons are consumed?
    • How will this package be updated or deprecated if the application moves away from Blade?

Integration Approach

Stack Fit

  • Primary Fit:

    • Laravel Applications: Ideal for Laravel projects using Blade for templating. The package leverages Laravel’s component architecture and integrates seamlessly with existing Blade templates.
    • Design Systems: Fits well into applications with a design system that relies on SVG icons for scalability and consistency.
  • Secondary Fit:

    • Hybrid Stacks: Applications using a mix of Blade and other templating engines (e.g., Inertia.js) can still leverage the raw SVG assets published by the package, though Blade-specific features (e.g., components) won’t be usable in non-Blade contexts.
    • Livewire/Alpine.js: Works well with Livewire or Alpine.js components that render Blade templates, as these components can use Blade components directly.
  • Non-Fit:

    • Non-Blade Applications: Projects not using Blade (e.g., pure API backends or non-Laravel frontend frameworks) will not benefit from the Blade-specific features and can only use the raw SVG assets.
    • Legacy Laravel Versions: Applications using Laravel <9 or PHP <8.0 will need to upgrade to use this package.

Migration Path

Phase 1: Assessment and Planning

  1. Audit Current Icon Usage:
    • Identify all current icon implementations (e.g., inline SVGs, font icons, or other libraries).
    • Document the variants and styles (e.g., sizes, colors) used across the application.
  2. Define Scope:
    • Decide which icon variants (outline, solid, mini, micro) will be adopted.
    • Determine if global defaults (via config) or inline styling will be used.
  3. Stakeholder Alignment:
    • Align with design and frontend teams on icon usage guidelines and any customizations needed.

Phase 2: Installation and Configuration

  1. Install the Package:
    composer require blade-ui-kit/blade-heroicons
    
  2. Publish Config (Optional):
    • If global defaults are needed, publish the config file:
      php artisan vendor:publish --tag=blade-heroicons-config
      
    • Configure defaults in config/blade-heroicons.php (e.g., default classes, attributes).
  3. Publish SVG Assets (Optional):
    • If raw SVGs are needed for non-Blade contexts:
      php artisan vendor:publish --tag=blade-heroicons --force
      
    • Update asset paths in Blade or frontend code to reference the published SVGs (e.g., {{ asset('vendor/blade-heroicons/o-arrow-left.svg') }}).

Phase 3: Incremental Adoption

  1. Replace Icons Gradually:
    • Start with low-risk components (e.g., buttons, tooltips) and replace existing icons with Blade Heroicons components.
    • Example replacement:
      <!-- Before: Inline SVG or font icon -->
      <svg class="w-6 h-6 text-gray-500" ...></svg>
      
      <!-- After: Blade Heroicons -->
      <x-heroicon-o-arrow-left class="w-6 h-6 text-gray-500"/>
      
  2. Leverage Blade Directives (Optional):
    • Use the @svg directive for dynamic icon rendering:
      @svg('heroicon-o-arrow-left', 'w-6 h-6', ['style' => 'color: #555'])
      
  3. Enable Caching (Recommended for Performance):

Phase 4: Testing and Validation

  1. Unit and Integration Testing:
    • Test Blade components that use Heroicons to ensure they render correctly in different contexts (e.g., dark mode, responsive layouts).
    • Verify that custom styles and attributes are applied correctly.
  2. Performance Testing:
    • Measure the impact of icon rendering on page load times, especially if caching is enabled.
    • Test with a large number of icons to ensure no performance degradation
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport