Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Has Images

Laravel Has Images Laravel Package

pharaonic/laravel-has-images

Laravel Has Images adds simple multi-image support to Eloquent models via a reusable HasImages trait. Upload, associate, resize, and retrieve images with polymorphic relationships and convenient helper methods, keeping image handling clean and consistent across your Laravel app.

View on GitHub
Deep Wiki
Context7

Laravel images provides a quick and easy way to link images with a model.

Frequently asked questions about Laravel Has Images
How do I install pharaonic/laravel-has-images in a Laravel app?
Install the package with Composer by running composer require pharaonic/laravel-has-images. After installation, add the HasImages trait to any Eloquent model that should own images. Then use the trait's helper methods to upload, associate, resize, and retrieve images. Check the repository README for any required migrations or configuration publishing steps.
How does the HasImages trait work with Eloquent models?
The HasImages trait adds reusable image-handling behavior directly to your Eloquent models. It uses a polymorphic relationship so a single images table can associate images with multiple model types. That means you can attach, retrieve, resize, and manage images without duplicating code in every model. Any model can opt in simply by using the trait.
Can I attach multiple images to one model with this package?
Yes. The package is built for simple multi-image support, so a model can own more than one image through the polymorphic relationship. You can upload and associate several images, then retrieve them through the trait's helper methods. This keeps galleries, product photos, and other multi-image use cases consistent across your app.
How do I resize images uploaded through Laravel Has Images?
The package overview mentions resizing as part of the image workflow, so you can generate resized versions when uploading or associating images. The exact resize API is defined by the trait methods and configuration in the repository README. Review the package source or documentation for supported dimensions and driver requirements before relying on a specific method name.
Does pharaonic/laravel-has-images support polymorphic image relationships?
Yes. The package description explicitly mentions polymorphic relationships as part of how images are associated with models. This allows one image record to belong to different Eloquent model types while keeping retrieval consistent. You can therefore reuse the same image infrastructure across posts, products, users, and other models.
Which Laravel versions are supported by pharaonic/laravel-has-images?
Laravel version support is declared in the package's composer.json constraints, so check that file or the README before installing. The package is designed for Laravel applications and follows Eloquent conventions. If you are on an older Laravel release, verify compatibility or test in a staging branch first.
How can I test image uploads when using the HasImages trait?
Use Laravel's Storage::fake helper to swap your image disk for a temporary filesystem during tests. Then create a model that uses the HasImages trait, attach a fake uploaded image, and assert that the image record and stored file exist. Keep resize or processing assertions focused on the behavior your app depends on, since image drivers can vary between environments.
What storage disk should I use for images in production with this package?
Configure a Laravel filesystem disk that suits your deployment, such as local storage for private files or S3 for scalable public images. The package works with Laravel's filesystem abstraction when storing uploaded images. In production, make sure the disk is writable, backed up, and served through the correct URL or CDN configuration.
What are alternatives to pharaonic/laravel-has-images for Laravel image management?
Spatie's laravel-medialibrary is a popular choice for advanced media collections and conversions. You can also pair Laravel's filesystem with intervention/image for custom resizing, or use a cloud service such as Cloudinary. pharaonic/laravel-has-images is a lighter option when you mainly need a simple HasImages trait and polymorphic image associations.
Is pharaonic/laravel-has-images actively maintained and safe for production?
Check the GitHub repository for recent commits, tagged releases, and open issues before adopting it in production. Review the package code and its Laravel version constraints, since maintenance activity can change over time. For production, pin a tested version in composer.lock and include image storage and backup checks in your deployment process.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin