- Does FluxUI Avatar work with Laravel 10 or Livewire 3?
- No, this package is explicitly built for Laravel 11 and Livewire 4. The architecture relies on Livewire 4’s property reactivity and Laravel 11’s features, so downgrading would require significant refactoring. If you’re on an older stack, consider a custom solution or wait for potential backports.
- How do I integrate this into an existing Flux UI app without breaking anything?
- The package uses Laravel’s view namespace shadowing to override the `<flux:avatar />` component non-invasively. Just install it, publish the config, and the avatar display will automatically update everywhere the starter kit uses the component. No manual template edits are needed, but ensure your view paths prioritize the package’s views.
- Can I use Spatie Media Library with this package?
- Yes, the package supports both Laravel’s filesystem disk and Spatie Media Library. To use Spatie, install `spatie/laravel-medialibrary`, add the `HasMedia` and `InteractsWithMedia` traits to your User model, and set `'driver' => 'spatie'` in the config. The package handles the rest, including collection naming and model integration.
- What happens if a user doesn’t have an avatar uploaded?
- The package automatically falls back to displaying initials based on the user’s name. This is handled by the `<flux:avatar />` component’s default template, which checks for the presence of an avatar path in the user model. The initials fallback is customizable via the config if you need different styling or logic.
- How do I customize the avatar upload UI or validation rules?
- You can publish the package’s views with `php artisan vendor:publish --tag=fluxui-avatar-views` to override the default upload form (`livewire/avatar-manager.blade.php`). Validation rules like file types, max size, and dimensions are configurable in `config/fluxui-avatar.php` under the `accepted_types`, `max_size`, and `dimensions` keys.
- Will this package work with my custom Livewire components?
- The package is tightly coupled with Flux UI’s component architecture and Livewire 4’s reactivity. While the `<livewire:avatar-manager />` component is standalone, integrating it into custom Livewire components may require additional work. For non-Flux/Livewire apps, this package is not recommended due to its specialized design.
- What storage options are available, and how do I switch between them?
- The package supports two storage drivers: `disk` (Laravel Filesystem) and `spatie` (Spatie Media Library). Switching drivers is as simple as changing the `'driver'` key in the config file. The disk driver requires a `avatar_path` column in your users table, while Spatie requires the `spatie/laravel-medialibrary` package and model traits.
- How do I handle avatar storage for large-scale applications?
- For large-scale apps, consider using the Spatie Media Library driver with cloud storage (e.g., S3) for better scalability. The disk driver is simpler but may not perform as well under heavy load. Additionally, you can extend the package by implementing a custom `AvatarStorageInterface` for advanced use cases like CDN integration or image optimization.
- Are there any performance considerations when using this package?
- The package is optimized for minimal overhead, but performance depends on your storage driver. Disk storage is faster for small-scale apps, while Spatie Media Library adds a slight overhead due to its ORM integration. For production, ensure your storage (e.g., S3) is properly configured for low latency, and consider caching avatar URLs if needed.
- What’s the maintenance roadmap for this package?
- The package is actively maintained by AgenticMorf, with updates aligned to Laravel, Livewire, and Flux UI releases. Check the GitHub repository for changelogs and open issues. If the package becomes abandoned, you can fork it or implement a custom solution using its architecture as a reference. Always review the license before forking.