Download the PHP package marshmallow/nova-fontawesome without Composer
On this page you can find all versions of the php package marshmallow/nova-fontawesome. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download marshmallow/nova-fontawesome
More information about marshmallow/nova-fontawesome
Files in marshmallow/nova-fontawesome
Package nova-fontawesome
Short Description A Font Awesome 6/7 Field for Laravel Nova 5
License MIT
Informations about the package nova-fontawesome
Laravel Nova Font Awesome Icons
A Laravel Nova field for selecting Font Awesome icons using the Font Awesome GraphQL API. This package loads icons on-demand via API calls, meaning you don't need to bundle all 30,000+ icons in your package.
Features
- ๐ Smart search - Uses Font Awesome's Algolia-powered fuzzy search
- ๐ On-demand loading - Icons are fetched via API, not bundled
- ๐ Infinite scroll - Load more icons automatically as you scroll
- ๐จ Style filtering - Filter by solid, regular, brands, light, thin, duotone
- ๐จโ๐ฉโ๐งโ๐ฆ Family support - Classic, Brands, Duotone, Sharp, Sharp-Duotone
- ๐พ Caching - API results are cached to reduce requests
- ๐ Dark mode - Full support for Nova's dark mode
- โก Debounced search - Prevents excessive API calls
- ๐ฑ Responsive - Works great on all screen sizes
- ๐ Fallback icons - Graceful degradation when API is unavailable
- ๐ Local fuzzy search - Instant results for common icons
- ๐ง CSS Strategies - Self-hosted, Kit, or CDN CSS loading
- ๐ Legacy format support - Auto-converts FA5 classes to modern format
- ๐ Debug endpoint - Built-in troubleshooting tools
[!important] This package was originally forked from mdixon18/fontawesome. Since we were making many opinionated changes, we decided to continue development in our own version rather than submitting pull requests that might not benefit all users of the original package. You're welcome to use this package, we're actively maintaining it. If you encounter any issues, please don't hesitate to reach out.
Requirements
- PHP ^8.2
- Laravel Nova ^5.0
- Laravel 11.x, 12.x or 13.x
- Font Awesome 6.x or 7.x
Note: For Nova 4 support, use version 1.x:
composer require marshmallow/nova-fontawesome:^1.0
Installation
Step 1: Install via Composer
Step 2: Set up Font Awesome CSS
The package needs Font Awesome CSS to render icons. Choose one of these options:
Option A: Self-hosted (Recommended for Pro users)
- Download Font Awesome from fontawesome.com
- Extract and copy the
cssandwebfontsfolders topublic/vendor/fontawesome/ - Add to your
.env:
Option B: Font Awesome Kit (Easiest for Pro)
- Get your Kit ID from fontawesome.com/kits
- Add to your
.env:
Option C: CDN (Free icons only)
No setup needed - this is the fallback if no other strategy is configured:
Step 3: Publish config (optional)
You can also publish the translation files if you want to customise the UI strings:
Step 4: Clear cache
That's it! The package uses the Font Awesome GraphQL API, so you don't need to manually download icon data.
CSS Loading Strategy
The package supports three CSS loading strategies (in order of priority):
1. Self-Hosted CSS (Recommended for Pro)
Download Font Awesome CSS files and host them on your server:
- Download Font Awesome from fontawesome.com
- Extract and copy to
public/vendor/fontawesome/ - Set strategy in
.env:
Directory structure:
2. Font Awesome Kit
Use your Font Awesome Kit for automatic Pro CSS loading:
Get your Kit ID from fontawesome.com/kits
3. CDN (Fallback - Free only)
Load free icons from CDN (default fallback):
Usage
Basic Usage
Available Methods
Set Font Awesome Version
Limit Icon Styles
Available styles: solid, regular, light, thin, duotone, brands
Set Icon Families
Available families: classic, brands, duotone, sharp, sharp-duotone
Note: Duotone, Sharp, and Sharp-Duotone require Font Awesome Pro.
Free vs Pro Icons
Font Awesome Kit ID (Pro)
Load Pro CSS using your Font Awesome Kit:
Or use a custom Pro CSS URL:
Allow Empty/Null Values
Custom Button Text
Limit Search Results (Per Page)
Minimum Search Length
Set Default Icon
Persist Default Icon
If you want to persist the default icon (when they press clear it brings back the default so it can't be empty):
Limit Available Icons
Client-Side Fuzzy Search
Enable or disable the local fuzzy search fallback:
Complete Example
Icon Class Format
Stored Value Format
The field stores icons in modern FA6/FA7 format:
Legacy Format Support
The package automatically supports legacy FA5 shorthand classes for backwards compatibility:
| Legacy Format | Converts To |
|---|---|
fas fa-home |
fa-solid fa-home |
far fa-user |
fa-regular fa-user |
fab fa-github |
fa-brands fa-github |
fal fa-star |
fa-light fa-star |
fat fa-circle |
fa-thin fa-circle |
fad fa-house |
fa-duotone fa-solid fa-house |
When convert_legacy_format is enabled in config (default), legacy formats are automatically converted when saving.
How It Works
This package uses the Font Awesome GraphQL API to:
- Search icons - When you type in the search box, a GraphQL query is sent to Font Awesome's API
- Infinite scroll - Results are paginated, loading more as you scroll down
- Cache results - Search results are cached for 1 hour to reduce API calls
- Fallback gracefully - If the API is unavailable, local fallback icons are used
API Endpoints
The package registers these API routes:
GET /nova-vendor/nova-fontawesome/search- Search icons (with pagination)GET /nova-vendor/nova-fontawesome/icon/{name}- Get a specific iconGET /nova-vendor/nova-fontawesome/metadata- Get available families and stylesGET /nova-vendor/nova-fontawesome/config- Get CSS configurationGET /nova-vendor/nova-fontawesome/convert- Convert legacy class formatGET /nova-vendor/nova-fontawesome/debug- Troubleshooting endpointGET /nova-vendor/nova-fontawesome/fallback- Get fallback icons
Configuration
After publishing the config file, you can modify config/nova-fontawesome.php:
Environment Variables
Add these to your .env file to customize the configuration:
Getting a Font Awesome API Token
To access Font Awesome Pro icons or improve API rate limits, you'll need an API token:
- Create or log in to your Font Awesome account at fontawesome.com/account
- Navigate to API Tokens section at fontawesome.com/account#api-tokens
- Generate a new token by clicking "Create Token"
- Copy the token and add it to your
.envfile:
Note: API tokens are automatically exchanged for short-lived access tokens and cached for performance. The package handles token refresh automatically.
Displaying Icons
In Blade Views
With Tailwind/Vite
If rendering icons in your frontend (outside Nova), make sure Font Awesome CSS is loaded:
Or via your vite.config.js:
Helper Method (Optional)
You can add a helper to your model:
Troubleshooting
Debug Endpoint
Visit /nova-vendor/nova-fontawesome/debug to check:
- API connectivity
- Token exchange status
- Search functionality
- Cache status
- CSS configuration
Icons not loading
- Check the debug endpoint for API errors
- Check that your server can reach
api.fontawesome.com - Check Laravel logs for errors
- Clear the cache:
php artisan cache:clear
CSS not loading / Icons showing as boxes
- Check your CSS strategy in config
- For self-hosted: verify files exist in
public/vendor/fontawesome/ - For Kit: verify your Kit ID is correct
- Check browser console for 404 errors
Styles not filtering correctly
Make sure you're using valid style names: solid, regular, light, thin, duotone, brands
Pro icons not showing
- Verify you have an active Font Awesome Pro subscription
- Check that your API token is correctly set in
.env - Use the debug endpoint to verify token exchange
- Ensure your CSS strategy supports Pro icons (self-hosted or kit)
Upgrading
From v1.x to v2.x
- Update
composer.jsonrequirements - Update
package.json- Vite replaces Laravel Mix - Rebuild assets:
npm install && npm run build - Update config file if published (new
csssection replacespro_css) - See UPGRADE.md for detailed migration guide
Development
Building Assets
Running Tests
Code Style
Static Analysis
License
The MIT License (MIT). Please see License File for more information.
Sponsorships
If you are reliant on this package in your production applications, consider sponsoring us! It is the best way to help us keep doing what we love to do: making great open source software.
Contributing
Feel free to suggest changes, ask for new features or fix bugs yourself. We're sure there are still a lot of improvements that could be made, and we would be very happy to merge useful pull requests.
Special thanks to
Made with love for open source
At Marshmallow we use a lot of open source software as part of our daily work. So when we have an opportunity to give something back, we're super excited!
We hope you will enjoy this small contribution from us and would love to Twitter for more updates!