Weave 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 Svg Laravel Package

nothingworks/blade-svg

A Laravel package for inlining SVG files directly in Blade templates. Use the @svg directive to embed icons and graphics with custom attributes and classes, plus caching for performance. Manage and style SVGs with CSS without extra HTTP requests.

View on GitHub
Deep Wiki
Context7

A package to easily make use of SVG icons in your Laravel Blade views.

Frequently asked questions about Blade Svg
Is nothingworks/blade-svg the same package as blade-ui-kit/blade-icons?
The supplied metadata is internally inconsistent: the Composer name describes a lightweight Blade directive for inlining SVG files, while the repository URL, description, star count, and release cadence describe blade-ui-kit/blade-icons. These are not the same artifact and they have different APIs, configuration surfaces, and upgrade paths. Confirm which package and version you are actually approving before installation.
How do I install nothingworks/blade-svg in a Laravel application?
Install it with Composer using composer require nothingworks/blade-svg, then let Laravel package discovery register the service provider if supported. Publish the configuration if the package provides one, register your SVG icon path, and start using the directive in Blade templates. Because the supplied metadata points to a different repository, verify the Composer package identity before running the install in a real project.
How do I use the @svg directive in a Blade template?
Use the @svg directive inside a Blade view to inline an SVG from your configured icon path, for example @svg('icon-name'). You can pass a CSS class string or an attributes array to control classes, width, height, and accessibility attributes, depending on the package version. Check the actual package documentation because the directive signature differs between the lightweight blade-svg wrapper and blade-ui-kit/blade-icons components.
How do I configure SVG icon paths for Laravel Blade SVG icons?
Publish the package configuration with php artisan vendor:publish if the package exposes a config file, then register one or more directories that contain your SVG files. Keep the directory layout and icon naming convention consistent before migrating existing icons. If you choose blade-ui-kit/blade-icons instead, icon sets are separate Composer packages, so the configuration approach is different.
Which Laravel and PHP versions does this SVG icon package support?
Check the package composer.json and release notes for the exact Laravel and PHP version constraints before adoption. The evaluation notes that compatibility must be confirmed against your project matrix, and that release cadence should track Laravel major versions. Do not assume support based on the repository star count or description alone.
Does inline SVG icon caching improve Blade performance?
Yes, the package includes caching for performance so compiled or inlined icon output does not require repeated filesystem reads on every render. You should still plan cache invalidation for deployments, because stale cached icon output can cause silent visual regressions rather than clear errors. Verify how the chosen package clears or rebuilds cached icons after a release.
Is inlining SVG icons in Blade safe for CSP and user input?
Inline SVG is markup injection by design, so treat icon names as sensitive whenever they can be influenced by user input. Validate icon names against a strict whitelist to prevent path traversal or loading arbitrary files. Review your Content Security Policy posture for style-src and img-src, and prefer fixed, developer-controlled icon names.
How do I add CSS classes and custom attributes to an inline SVG icon?
Pass a class string or an attributes array to the Blade directive or component, depending on the package API. This lets you set classes, width, height, role, aria-hidden, and other attributes while keeping styling in CSS. The package will not enforce consistent accessibility handling, so define a convention for decorative versus meaningful icons.
Will Blade SVG icons work with Tailwind CSS and Vite?
Inline SVG changes how Tailwind and Vite tree-shaking or CSS purging behave compared with icon fonts, because classes may appear inside SVG markup or be applied by the directive. Verify that any utility classes used by icons are detected by your content configuration or safelisted where necessary. Test the production build, not just the local development server.
How should I migrate from icon fonts or file_get_contents to Blade SVG icons?
Treat this as a view-layer refactor rather than a simple dependency install. Inventory existing icon usage by searching for icon-font classes, raw SVG markup, file_get_contents calls, and existing partials, then choose a naming convention and directory layout before writing code. Wrap the vendor package in one internal Blade component or helper so its API appears in only one place and you can migrate incrementally.
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.
vento/laravel-airbrake
wfeller/laravel-batch
maco-studios/mage-os-installer
busarm/armie
siberfx/laravel-logger
kfteam1991/dcat-admin
dashed/dashed-laposta
dashed/dashed-ecommerce-montaportal
dashed/dashed-ecommerce-etsy
neohq/string-blade-compiler
log1x/acf-composer
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager