Fancy Flux supports configurable component prefixes to avoid naming conflicts with official Flux components or other custom component packages.
- Avoid Conflicts: If Flux releases an official
carouselcomponent, your prefixed version won't conflict - Multiple Packages: If you use multiple custom Flux component packages, prefixes prevent naming collisions
- Clear Ownership: Makes it clear which components are from Fancy Flux vs official Flux
php artisan vendor:publish --tag=fancy-flux-configThis creates config/fancy-flux.php in your application.
After publishing, edit config/fancy-flux.php:
return [
'prefix' => 'fancy',
'use_flux_namespace' => true,
'enable_demo_routes' => false,
];Configuration Priority:
Configuration is loaded in this order (later values override earlier ones):
- Default PHP config (
config/fancy-flux.php) - Base defaults - Environment variables (
.env) - Highest priority, overrides PHP config
Environment Variables (Optional Override):
You can override PHP config with environment variables:
FANCY_FLUX_PREFIX=fancy
FANCY_FLUX_USE_FLUX_NAMESPACE=true
FANCY_FLUX_ENABLE_DEMO_ROUTES=falseConfiguration Options:
prefix- Custom prefix for components (e.g.,"fancy","custom","myapp"). Set tonullfor no prefix.use_flux_namespace- Whentrue, components are also available in thefluxnamespace. Set tofalseto use ONLY the prefixed namespace.enable_demo_routes- Whentrue, demo routes are loaded from the package. Set tofalseto publish and customize routes yourself.
When FANCY_FLUX_PREFIX is not set or empty:
<!-- Components available as: -->
<flux:carousel :data="$slides" />
<flux:color-picker wire:model="color" />
<flux:emoji-select wire:model="emoji" />When prefix: "fancy" and use_flux_namespace: true in config/fancy-flux.php:
<!-- Components available with prefix: -->
<fancy:carousel :data="$slides" />
<fancy:color-picker wire:model="color" />
<fancy:emoji-select wire:model="emoji" />
<!-- Also available in flux namespace (backward compatibility): -->
<flux:carousel :data="$slides" />
<flux:color-picker wire:model="color" />
<flux:emoji-select wire:model="emoji" />When FANCY_FLUX_PREFIX=fancy and FANCY_FLUX_USE_FLUX_NAMESPACE=false:
<!-- Components ONLY available with prefix: -->
<fancy:carousel :data="$slides" />
<fancy:color-picker wire:model="color" />
<fancy:emoji-select wire:model="emoji" />
<!-- flux: namespace will NOT work (prevents conflicts) -->- Type:
string|null - Default:
null - Description: Custom prefix for Fancy Flux components
- Examples:
"fancy","custom","myapp", ornullfor no prefix
- Type:
boolean - Default:
true - Description: When
true, components are also registered in thefluxnamespace for backward compatibility. Whenfalse, components are ONLY available with the custom prefix.
- Type:
boolean - Default:
false - Description: When
true, demo routes are loaded from the package at/fancy-flux-demos/*. Whenfalse, you can publish and customize routes yourself.
If you want to start using a prefix in an existing project:
-
Set the prefix in
.env:FANCY_FLUX_PREFIX=fancy FANCY_FLUX_USE_FLUX_NAMESPACE=true
-
Gradually update templates: Components will still work with
flux:namespace, but you can gradually migrate to the prefixed version:<!-- Old --> <flux:carousel :data="$slides" /> <!-- New --> <fancy:carousel :data="$slides" />
-
Eventually disable flux namespace (optional):
FANCY_FLUX_USE_FLUX_NAMESPACE=false
To remove a prefix and return to default behavior:
-
Set
prefixtonullinconfig/fancy-flux.php:return [ 'prefix' => null, // ... other config ];
-
Clear config cache:
php artisan config:clear
-
Components will be available as
<flux:component-name>again
- Use a prefix from the start if you're concerned about future conflicts
- Keep
use_flux_namespace=trueduring development for flexibility - Set
use_flux_namespace=falsein production if you want strict namespace separation - Use descriptive prefixes that match your project/company name (e.g.,
fancy,acme,myapp)
If components aren't working after setting a prefix:
-
Clear config cache:
php artisan config:clear
-
Verify config:
php artisan tinker >>> config('fancy-flux.prefix') >>> config('fancy-flux.use_flux_namespace') >>> config('fancy-flux.enable_demo_routes')
-
Check PHP config: Ensure
config/fancy-flux.phpexists and returns a valid array -
Check namespace: Make sure you're using the correct namespace in your Blade templates
If use_flux_namespace=false but both namespaces still work:
-
Clear all caches:
php artisan optimize:clear
-
Restart your development server if using
php artisan serve
- README - Main package documentation
- Component Documentation - Detailed component guides