- How do I install mrshanebarron/avatar in a Laravel app?
- Install it with Composer using composer require mrshanebarron/avatar, then publish the package config with php artisan vendor:publish using the package's publish tag. The package is a conventional Laravel library, so it ships a service provider that is likely auto-discovered and a vendor-prefixed config file. Pin an explicit version such as v1.0.1 rather than a wide caret constraint while the config naming changes settle. After publishing, run php artisan config:clear locally and confirm the config file appears in your app's config directory.
- How do I display a user avatar in a Blade template?
- The package is built for Blade and Eloquent integration, so you render avatars directly from your views after installing and publishing the config. Typical usage is passing a user model or name into the package's Blade component or helper and letting it produce the avatar markup. Check the README for the exact component name and argument order, since that surface is where usage examples live. Test the rendered output once in a real view before rolling it across your templates.
- Can I customize avatar colors and sizes?
- Yes. The package supports customizable colors and sizes, which are driven by the published config file and can be adjusted per project. Because config is read through Laravel's config repository, changes go in the published config file rather than in vendor code. If you override values at runtime, clear or rebuild the config cache so the new values actually load.
- Where is the avatar config file published and what is it called?
- The package publishes a vendor-prefixed configuration file, and release 1.0.1 fixed its naming around the sb- prefix. That means values are read with config('sb.*') keys and the file lands in your application's config directory. Publish it with vendor:publish using the package's tag, and verify the resulting filename and root key in the diff before committing. Never edit the copy inside vendor, since it will be replaced on the next Composer update.
- Why did my avatar settings stop applying after upgrading to v1.0.1?
- That release renamed the published config file, and Laravel handles a stale or renamed config file silently by falling back to package defaults instead of throwing an error. The result is that your app keeps booting while avatar colors, sizes, or other settings drift from what you configured. Delete the old-named file deliberately, republish with the current tag, and port your customised values across. Then rebuild the config cache in your deploy pipeline so the change takes effect.
- Does the package cache generated avatars, and how do I clear that cache?
- Yes, caching is a supported feature, which is useful for initials-based images that do not change often. Clear the relevant cache store when you change avatar settings, colors, or sizes, otherwise users may keep seeing stale images. In production, treat avatar cache invalidation the same as any other cache concern and include it in your deploy runbook. Verify with a smoke test that renders an avatar rather than only checking that the app boots.
- Which Laravel and PHP versions does mrshanebarron/avatar support?
- Check the illuminate/support constraint in the package's composer.json against your application's Laravel major before committing, because that is the most common blocker for otherwise-compatible Laravel packages. The release note for 1.0.1 focuses on config file naming and does not publish a version matrix, so do not assume support for older or newer Laravel releases. Run composer update in a branch and confirm dependency resolution succeeds. Also verify package discovery is enabled so the service provider registers automatically.
- Did the sb- config prefix change also rename the config keys, and is that a breaking change?
- That is the key question to answer before treating 1.0.1 as a drop-in patch. If only the filename changed, existing config('old-prefix.*') lookups may still work, but if the root key moved to sb, every reference in application code becomes a silent null. A root key rename shipped as a patch release would be a semver violation and should be scheduled as a breaking change. Diff your config directory and grep for config key usage before upgrading production.
- How do I test avatar rendering in my Laravel test suite?
- Assert against the rendered Blade output rather than the internal implementation, so tests survive package upgrades. Set the avatar config explicitly in your test case or phpunit.xml so color and size assertions do not depend on published defaults. In the testing environment, keep config caching disabled so overrides take effect. Add a CI assertion that the package config is publishable and cacheable, which catches the class of drift introduced by file renames automatically.
- Is it easy to remove mrshanebarron/avatar if I decide not to use it?
- Yes. Because the package integrates through a publishable config file and Blade and Eloquent helpers, removal is a Composer remove plus deleting the published config file. There is no application-architecture commitment beyond that config surface, which makes it low-risk to trial. Watch out for a short sb- prefix collision with another package publishing sb-*.php, since one file can overwrite the other. If you remove the package, also delete any stale config files so nothing silently falls back to defaults.