### Initial Development Setup
Source: https://github.com/mallardduck/blade-lucide-icons/blob/main/CONTRIBUTING.md
Run this command for first-time setup to install git hooks and sync the lucide submodule.
```bash
make setup
```
--------------------------------
### Install Blade Lucide Icons
Source: https://github.com/mallardduck/blade-lucide-icons/blob/main/README.md
Install the package using Composer. Ensure your project meets the PHP and Laravel version requirements.
```bash
composer require mallardduck/blade-lucide-icons
```
--------------------------------
### Available Development Commands
Source: https://github.com/mallardduck/blade-lucide-icons/blob/main/CONTRIBUTING.md
A list of common Make commands for managing the project, including syncing submodules, updating, installing hooks, and running tests.
```bash
make help # Show all available commands
```
```bash
make sync # Manually sync submodules
```
```bash
make update # Pull latest changes and sync submodules
```
```bash
make install-hooks # Install git hooks
```
```bash
make test # Run test suite
```
--------------------------------
### Running the Test Suite
Source: https://github.com/mallardduck/blade-lucide-icons/blob/main/CONTRIBUTING.md
Execute the project's test suite using either the Make command or directly via PHPUnit.
```bash
make test
```
```bash
php vendor/bin/phpunit
```
--------------------------------
### Default Configuration Options
Source: https://context7.com/mallardduck/blade-lucide-icons/llms.txt
Customize the package's behavior by modifying the published configuration file. Options include setting a default prefix, fallback icon, global CSS classes, and default HTML attributes.
```php
// config/blade-lucide-icons.php
return [
// Prefix used in Blade components:
'prefix' => 'lucide',
// Fallback icon name if a requested icon is not found
'fallback' => '',
// CSS classes applied to every icon by default
'class' => 'icon',
// HTML attributes applied to every icon by default
'attributes' => [
'width' => 24,
'height' => 24,
],
];
```
--------------------------------
### Publish Configuration File
Source: https://github.com/mallardduck/blade-lucide-icons/blob/main/README.md
Publish the configuration file to customize default classes, attributes, and other Blade Icons features.
```bash
php artisan vendor:publish --tag=blade-lucide-icons-config
```
--------------------------------
### Manual Submodule Management
Source: https://github.com/mallardduck/blade-lucide-icons/blob/main/CONTRIBUTING.md
Commands for manually initializing and updating git submodules if not using the automated Make commands.
```bash
git submodule update --init --recursive
```
```bash
git submodule update --recursive
```
--------------------------------
### Enable Icon Caching
Source: https://context7.com/mallardduck/blade-lucide-icons/llms.txt
Enables icon caching to avoid repeated filesystem reads in production, significantly improving performance. Recommended to add to your deployment script.
```bash
# Cache all registered icon sets
php artisan icons:cache
```
```bash
# Clear the icon cache (e.g., after deploying new icons)
php artisan icons:clear
```
```php
// Recommended: add to your deployment script (e.g., Deployer, Envoyer)
// alongside route:cache and config:cache
Artisan::call('icons:cache');
```
--------------------------------
### Use the `svg()` PHP Helper
Source: https://context7.com/mallardduck/blade-lucide-icons/llms.txt
The global `svg()` helper renders icons programmatically in PHP code or tests. It accepts the icon name, optional CSS classes, and optional HTML attributes.
```php
use Illuminate\Support\Facades\Blade;
// Render an icon to HTML string
$html = svg('lucide-activity')->toHtml();
// With CSS classes
$html = svg('lucide-bell', 'w-6 h-6 text-gray-500')->toHtml();
// With arbitrary HTML attributes
$html = svg('lucide-bell', ['style' => 'color: #555'])->toHtml();
// Output in a Blade view via a controller
class DashboardController extends Controller
{
public function index()
{
$iconHtml = svg('lucide-activity', 'w-5 h-5 text-green-500')->toHtml();
return view('dashboard', ['statusIcon' => $iconHtml]);
}
}
```
```blade
{{-- In the view, render the pre-built HTML safely --}}
{!! $statusIcon !!}
```
--------------------------------
### Publish Raw SVG Icons
Source: https://github.com/mallardduck/blade-lucide-icons/blob/main/README.md
Publish all raw SVG icons to the public vendor directory if you need to use them as image assets. Use the --force flag to overwrite existing files.
```bash
php artisan vendor:publish --tag=blade-lucide-icons --force
```
--------------------------------
### Bump Package Version Script
Source: https://context7.com/mallardduck/blade-lucide-icons/llms.txt
Reads the current version from git tags, calculates the new version based on bump type, and updates CHANGELOG.md. Outputs the new version string.
```bash
# Usage: php bin/bump-version.php [changes_json]
# Patch bump for Lucide 0.561.0 with optional changes JSON
php bin/bump-version.php patch 0.561.0 '{"bump_type":"patch","changes":{...},"summary":{...}}'
# Minor bump (icons were removed)
php bin/bump-version.php minor 0.562.0
# Output: new package version, e.g. "1.27.0"
```
--------------------------------
### Detect Icon Changes (PHP)
Source: https://github.com/mallardduck/blade-lucide-icons/blob/main/bin/README.md
Analyzes icon file changes between commits to determine the semantic version bump type. Outputs a JSON object detailing the bump type and specific changes.
```bash
php bin/detect-icon-changes.php
```
--------------------------------
### Render Basic Lucide Icons
Source: https://context7.com/mallardduck/blade-lucide-icons/llms.txt
Use the `x-lucide-{icon-name}` syntax to render any Lucide icon as a self-closing Blade component. The icon name corresponds to the SVG filename.
```blade
{{-- Render a simple activity icon --}}
```
```blade
{{-- Render a bell icon --}}
```
```blade
{{-- Render an anchor icon --}}
```
--------------------------------
### Bump Package Version (PHP)
Source: https://github.com/mallardduck/blade-lucide-icons/blob/main/bin/README.md
Bumps the package version based on the provided bump type and updates the CHANGELOG.md file. Reads the current version from git tags and optionally uses change details from a JSON input.
```bash
php bin/bump-version.php [changes_json]
```
--------------------------------
### Detect Icon Changes Script
Source: https://context7.com/mallardduck/blade-lucide-icons/llms.txt
Compares current SVG files against the previous git commit to output a JSON report of icon changes and a recommended semantic version bump type. Stage generated SVG files first.
```bash
# Stage generated SVG files first so git diff includes them
git add resources/svg/
# Run the detection script
php bin/detect-icon-changes.php
```
```json
// Example output
{
"bump_type": "patch",
"changes": {
"added": ["new-icon", "another-icon"],
"removed": [],
"modified": ["activity"]
},
"summary": {
"added_count": 2,
"removed_count": 0,
"modified_count": 1
}
}
```
--------------------------------
### Reference Published SVG as Image
Source: https://context7.com/mallardduck/blade-lucide-icons/llms.txt
Reference a published SVG as a standard tag using the asset helper.
```blade
{{-- Reference a published SVG as a standard tag --}}
```
--------------------------------
### Use Raw SVG Icons in Views
Source: https://github.com/mallardduck/blade-lucide-icons/blob/main/README.md
Reference published SVG icons as image assets in your Blade views using the asset helper.
```blade
```
--------------------------------
### Apply Inline Styles to Icons
Source: https://context7.com/mallardduck/blade-lucide-icons/llms.txt
Use the `style` attribute to apply inline CSS properties for custom or dynamic styling. This allows for precise control over icon appearance.
```blade
{{-- Custom color via inline style --}}
```
```blade
{{-- Dynamic color from a PHP variable --}}
```
```blade
{{-- Multiple style properties --}}
```
--------------------------------
### Set Width and Height Attributes
Source: https://context7.com/mallardduck/blade-lucide-icons/llms.txt
Control the rendered size of icons by passing explicit `width` and `height` attributes to the component. This is useful for precise layout control.
```blade
{{-- Fixed pixel size --}}
```
```blade
{{-- Used as an img-style icon in a nav bar --}}
```
--------------------------------
### Use Lucide Icons as Blade Components
Source: https://github.com/mallardduck/blade-lucide-icons/blob/main/README.md
Render icons as self-closing Blade components. You can add CSS classes or inline styles directly to the component tag.
```blade
```
```blade
```
```blade
```
```blade
```
--------------------------------
### Add CSS Classes to Icons
Source: https://context7.com/mallardduck/blade-lucide-icons/llms.txt
Apply CSS classes directly to the SVG element by passing a `class` attribute to the icon component. This is useful for styling with utility frameworks like Tailwind CSS.
```blade
{{-- Size and color with Tailwind --}}
```
```blade
{{-- Larger icon with a brand color --}}
```
```blade
{{-- Icon inside a button --}}
```
--------------------------------
### Use SVG in Object Tag
Source: https://context7.com/mallardduck/blade-lucide-icons/llms.txt
Use an SVG in an