plank/laravel-mediable
A package for easily uploading and attaching media files to models with Laravel
7.0.0
1.7M downloads/mo
#3869 most downloaded on Packagist
plank/laravel-mediable
What this package is like to depend on
Last release 1 months ago
13 Jul 2026
Release timing varies
gaps range from 4 weeks to 12 months
Most releases are documented
notes for 82 of 92 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
92 releases · first in 2016
3 releases in the last 12 months
see the full history below
Release timeline
92 releases · Jul 2016 to Jul 2026Releases
latest 60 of 92-
7.0.013 Jul 2026Release notes
Open source →What's Changed
This is a security release, upgrading is strongly recommended
- Added
mediable.allowed_remote_hostsconfiguration which allows restricting remote URL source adapters to a whitelist. Wildcard subdomains may be specified with*.example.comsyntax. By default, all hosts are allowed. - If no
mediable.allowed_remote_hostsallow list is provided, theRemoteUrlAdapterwill reject private IP addresses and localhost by default, to prevent Server-Side Request Forgery (SSRF) attacks. [CVE-2026-49969] - Added
mediable.allowed_remote_schemesconfiguration which allows restricting remote URL source adapters to a whitelist of allowed URL schemes (e.g.http,https,ftp, etc.). By default, onlyhttpsis allowed. When modifying this configuration, it may also be necessary to modify thesource_adapterspattern matching. - Directory validation will now strip
.characters from path segments. This prevents attackers from using directory traversal patterns like../as well as preventing potential issues with certain filesystems where.characters in directory names may cause unexpected behaviour. [CVE-2026-49970] - Added
mediable.file_sanitizersconfiguration which allows specifying custom sanitizers for rewriting file contents to strip out security risks before they are uploaded. A sanitizer must implements thePlank\Mediable\Sanitizers\SanitizerInterfaceinterface. - Added
SvgSanitizerwhich will strip executable javascript and other untrusted content fromimage/svg+xmlfiles, which can result in stored XSS if rendered directly to a webpage. By default, this sanitizer is applied to all uploaded SVG files. It can be disabled by removing it from themediable.sanitizersconfig array. [CVE-2026-49971] - Added
mediable.forbidden_file_extensionsconfiguration andMediaUploader::setForbiddenExtensions()which allows specifying a blacklist of file extensions that are forbidden to be uploaded. Any file extension which is considered executable by your Apache or Nginx configuration should be included in this list. A number of common executable file extensions are included in this list by default to prevent remote code execution exploits. - In addition, forbidden file extensions are now sanitized if they are nested within destination filenames (e.g.
script.php.jpgbecomesscript-php.jpg). This prevents remote code execution from double extension bypass due to common Apache and Nginx misconfigurations - Added
mediable.forbidden_mime_typesconfiguration andMediaUploader::setForbiddenMimeTypes()which allows specifying a blacklist of MIME types that are forbidden to be uploaded. - MediaUploader::ON_DUPLICATE_* constants have been moved to an
Plank\Mediable\Enum\OnDuplicateBehaviourenum. - Added
MediaUploaderConfigurationclass. MostMediaUploaderinstance properties are moved to this class. TheMediaUploaderclass now accepts this as a constructor argument instead of an array of configs. MediaUploader::beforeSave()now accepts a\Closureinstead of acallablefor better static analysis and type safety.
Full Changelog: 6.5.0...7.0.0
Release notes
Open source →This is a security release, upgrading is strongly recommended
- Added
mediable.allowed_remote_hostsconfiguration which allows restricting remote URL source adapters to a whitelist. Wildcard subdomains may be specified with*.example.comsyntax. By default, all hosts are allowed. - If no
mediable.allowed_remote_hostsallow list is provided, theRemoteUrlAdapterwill reject private IP addresses and localhost by default, to prevent Server-Side Request Forgery (SSRF) attacks. [CVE-2026-49969] - Added
mediable.allowed_remote_schemesconfiguration which allows restricting remote URL source adapters to a whitelist of allowed URL schemes (e.g.http,https,ftp, etc.). By default, onlyhttpsis allowed. When modifying this configuration, it may also be necessary to modify thesource_adapterspattern matching. - Directory validation will now strip
.characters from path segments. This prevents attackers from using directory traversal patterns like../as well as preventing potential issues with certain filesystems where.characters in directory names may cause unexpected behaviour. [CVE-2026-49970] - Added
mediable.file_sanitizersconfiguration which allows specifying custom sanitizers for rewriting file contents to strip out security risks before they are uploaded. A sanitizer must implements thePlank\Mediable\Sanitizers\SanitizerInterfaceinterface. - Added
SvgSanitizerwhich will strip executable javascript and other untrusted content fromimage/svg+xmlfiles, which can result in stored XSS if rendered directly to a webpage. By default, this sanitizer is applied to all uploaded SVG files. It can be disabled by removing it from themediable.sanitizersconfig array. [CVE-2026-49971] - Added
mediable.forbidden_file_extensionsconfiguration andMediaUploader::setForbiddenExtensions()which allows specifying a blacklist of file extensions that are forbidden to be uploaded. Any file extension which is considered executable by your Apache or Nginx configuration should be included in this list. A number of common executable file extensions are included in this list by default to prevent remote code execution exploits. - In addition, forbidden file extensions are now sanitized if they are nested within destination filenames (e.g.
script.php.jpgbecomesscript-php.jpg). This prevents remote code execution from double extension bypass due to common Apache and Nginx misconfigurations - Added
mediable.forbidden_mime_typesconfiguration andMediaUploader::setForbiddenMimeTypes()which allows specifying a blacklist of MIME types that are forbidden to be uploaded. - MediaUploader::ON_DUPLICATE_* constants have been moved to an
Plank\Mediable\Enum\OnDuplicateBehaviourenum. - Added
MediaUploaderConfigurationclass. MostMediaUploaderinstance properties are moved to this class. TheMediaUploaderclass now accepts this as a constructor argument instead of an array of configs. MediaUploader::beforeSave()now accepts a\Closureinstead of acallablefor better static analysis and type safety.
- Added
-
6.5.005 Apr 2026Release notes
Open source →What's Changed
- Added compatibility with symfony 8.X by @frasmage in #389
- Added support for intervention/image:4.0 by @frasmage in #388
- Dropped support for intervention/image:2.X
- Added
ImageManipulation::setOutputOptions(), to support various intervention/image output format settings - Deprecated
ImageManipulation::setOutputQuality(). Use the 'quality' key insetOutputOptions()instead
Full Changelog: 6.4.0...6.5.0
-
6.4.024 Feb 2026Release notes
Open source →What's Changed
- Added Laravel 13 support
- Removed Laravel 11 support
- Minimum supported PHP version is now 8.3
Full Changelog: 6.3.1...6.4.0
-
6.3.106 Mar 2025Release notes
Open source →What's Changed
- Don't require CLI to execute migrations by @syssi in #376
- Fix template type definition in MediableCollection by @marvinschroeder in #378
New Contributors
- @syssi made their first contribution in #376
- @marvinschroeder made their first contribution in #378
Full Changelog: 6.3.0...6.3.1
-
6.3.028 Feb 2025 -
6.2.103 Jan 2025Release notes
Open source →What's Changed
- Fix imageManipulation::outputWebpFormat() encoding by @frasmage in #373
- Update 2020_10_12_000000_add_variants_to_media.php by @solomon-ochepa in #372
- adjust variant FK constraint drop by @frasmage in #374
New Contributors
- @solomon-ochepa made their first contribution in #372
Full Changelog: 6.2.0...6.2.1
-
6.2.005 Dec 2024Release notes
Open source →What's Changed
- Added support for PHP 8.4 by @selfsimilar in #362
- MediaUploader directory now defaults to empty string by @EriBloo in #366
- add support for HEIC image files by @frasmage in #368
- add php 8.4 to test suite by @frasmage in #369
New Contributors
- @selfsimilar made their first contribution in #362
- @EriBloo made their first contribution in #366
Full Changelog: 6.1.3...6.2.0
-
6.1.302 Sep 2024Release notes
Open source →What's Changed
- Migration Class Refactor and Column Existence Check by @anilkumarthakur60 in #358
Full Changelog: 6.1.2...6.1.3
-
6.1.211 Apr 2024Release notes
Open source →What's Changed
- Fix publish add_alt_to_media migration by @jason-nabooki in #353
New Contributors
- @jason-nabooki made their first contribution in #353
Full Changelog: 6.1.1...6.1.2
-
6.1.109 Apr 2024 -
6.1.009 Apr 2024Release notes
Open source →- Attempt to automatically select an
intervention/imagedriver based on the available extensions. - Fix an error in package discovery if attempting to install both
plank/laravel-mediableandintervention/image-laravelat the same time
- Attempt to automatically select an
-
6.0.509 Apr 2024 -
6.0.409 Apr 2024Release notes
Open source →- Fix alt migration default value for the mysql dialect. Default value assigned from the Media model
-
6.0.309 Apr 2024 -
6.0.209 Apr 2024Release notes
Open source →- Added
intervention/image-laravelpackage to the composer suggests list - Updated documentation with configuration instructions for intervention/image
- Added
-
6.0.107 Apr 2024 -
6.0.007 Apr 2024Release notes
Open source →Compatibility
- Dropped support for PHP 7.4 and 8.0
- Dropped Support for Laravel 8 and 9
- Added Support for PHP 8.3
- Added Support for Laravel 11
- Added support for intervention/image 3.0
- Modernized the database migration files to use more recent Laravel conventions.
Mediable
- Added
MediableInterface
MediaUploader
- Added support for recording alt attributes on Media (database migration required). MediaUploader now exposes a
withAltAttribute()method to set the alt attribute on the generated media record. - Added
MediaUploader::applyImageManipulation()to make changes to the original uploaded image during the upload process. - Added
MediaUploader::validateHash()to ensure that the hash of the uploaded file matches a particular value during upload. Supports any hashing algorithm supported by PHP'shash()function. - By default, the MediaUploader will always use the MIME type inferred from the file contents, regardless of the source. Added the
MediaUploader::preferClientMimeType()to indicate that the MIME type provided by the source should be used instead, if provided. The default behaviour can be configured with the'prefer_client_mime_type'key in theconfig/mediable.phpfile. - The
MediaUploader::useHashForFilename()method now accepts an optional parameter to specify which hashing algorithm to use to generate the filename. Supports any hashing algorithm supported by PHP'shash()function. - MediaUploader will now use the visibility defined on the filesystem disk config if the
makePublic()/makePrivate()methods are not called, instead of assuming public visibility. - MediaUploader now supports data URL strings as an input source, e.g.
data:image/jpeg;base64,.... - If a filename is not provided to the MediaUploader, and none can be inferred from the source, the uploader will throw an exception.
- If the file extension is not available from the source, the uploader will now consistently infer it from the MIME type. Previously this behaviour was inconsistent across different source adapters.
SourceAdapters
All SourceAdapter classes have been significantly refactored.
- All sourceAdapters will now never load the entire file contents into memory (unless it is already in memory) to determine metadata about the file, in order to avoid memory exhaustion when dealing with large files. If reading the file is necessary, most adapters will attempt use a single streamed scan of the file to load all metadata at once, to speed up to the precess. Remote files will be cached to
temp://to avoid repeated HTTP requests. - Removed
getStreamResource()method. The method has been replaced with thegetStream(): StreamInterface, which returns a PSR-7 stream implementation instead. - Added
hash(string $algo): stringmethod which is expected to return the hash of the file contents using the specified algorithm. - The return type of the
filename()andextension()method is now nullable. If the adapter cannot determine the value from the information available, it should return null. - Removed the
getContents()method. ThegetStream()->getContents()method may be used instead. - Removed the
getSource()method. No replacement. - Removed the
path()method. No replacement. - Removed the
valid()method. SourceAdapters should now throw an exception with a more helpful message from the constructor if the source is not valid.
ImageManipulation
- Added support for optimizing manipulated images, using the spatie/image-optimizer package, which supports a variety of image optimization tools for different image formats (
jpegoptim,pngquant,optipng,gifsicle, etc.) - Default image optimization behaviour can configured in the
config/mediable.phpfile to specify the optimization tools to use and their arguments. - Added
ImageManipulation::noOptimization()andImageManipulation::optimize(?array $optimizers = null)methods to allow overriding the defaults set in the config file. - The
ImageManipulation::useHashForFilename()method now accepts an optional parameter to specify which hashing algorithm to use to generate the filename. Supports any hashing algorithm supported by PHP'shash()function. - The
ImageManipulation::usingHashForFilename()method has been renamed toImageManipulation::isUsingHashForFilename()to avoid confusion with theuseHashForFilename()method.
Media
- Added
altattribute to the Media model. - The Media class now exposes a dynamic
urlattribute which will generate a URL for the file (equivalent to thegetUrl()method).
Other
- Improved
MediableCollectionannotions to support generic types. - Added missing type declarations to most property and method signatures.
- Removed the
\Plank\Mediable\Streamclass in favor of theguzzlehttp/psr7implementation. This removes the direct dependency on thepsr/http-messagelibrary. \Plank\Mediable\HandlesMediaUploadExceptions::transformMediaUploadException()parameter and return type changed from\Exceptionto\Throwable.- Added PHPStan static analysis to the test suite.
-
5.9.117 May 2023Nothing published for this version
-
5.9.017 Feb 2023Nothing published for this version
-
5.8.003 Jan 2023Nothing published for this version
-
5.7.022 Nov 2022Nothing published for this version
-
5.6.025 Jun 2022Nothing published for this version
-
5.5.010 May 2022Release notes
Open source →- Filename and pathname sanitization will use the app locale when transliterating UTF-8 characters to ascii.
- Restored original behaviour of treating unrecognized mime types as
application/octet-stream(changed in recent version of Flysystem)
-
5.4.107 Apr 2022 -
5.4.012 Feb 2022Release notes
Open source →- Added support for Laravel 9
- Dropped support for PHP 7.3
- Dropped support for Laravel 6.x and 7.x
- Fixed S3 temporary URL generation not respecting disk root configuration.
-
5.3.111 Dec 2021 -
5.2.128 Oct 2021Release notes
Open source →- Fix aggregate type matching not properly handling case mismatches of mime types and/or extensions
- Handle Guzzle stream_for()` deprecation
-
5.2.008 Sep 2021 -
5.1.130 Apr 2021 -
5.1.029 Apr 2021Release notes
Open source →- Added
MediaUploader::onDuplicateReplaceWithVariants()which behaves similar toonDuplicateReplace()but will also delete any variants of the replaced Media record. - Fixed
onDuplicateUpdate()failing if file exists but without a matching model.
- Added
-
5.0.712 Dec 2020 -
5.0.605 Dec 2020 -
5.0.505 Dec 2020Release notes
Open source →ImageManipulatornow uses$media->contents()instead of$media->stream(), as Intervention Image loads the whole file into memory anyways, and the former seems to have fewer hiccups for various cloud filesystems.
-
5.0.403 Dec 2020 -
5.0.329 Oct 2020 -
5.0.223 Oct 2020Release notes
Open source →- Fixed additional bugs with the
MediableCollection::delete()method - Optimized the execution speed of
MediableCollection::delete()
- Fixed additional bugs with the
-
5.0.122 Oct 2020Release notes
Open source →- fixed notices generated from collection offset access in
MediableCollection::delete()
- fixed notices generated from collection offset access in
-
5.0.015 Oct 2020Release notes
Open source →- Added support for creating image variants using the intervention/image library. Variants can be created synchronously in the current process or asychronously as queued jobs. Media records keep track of variants created from them.
- Fixed Laravel 8+ migration squashing. Database migrations are now loaded from within the package instead of copied to the application's database/migration directory. See UPGRADING.md for steps to avoid conflicts.
- Directory and filename validation now only allows URL and filesystem safe ASCII characters (alphanumeric plus
.,-,_, and/for directories). Will automatically attempt to transliterate UTF-8 accented characters and ligatures into their ASCII equivalent, all other characters will be converted to hyphens. - Added
Media::stream()method to easily retrieve a PSR-7 compatible Stream. - Added support for generating temporary URLs for files hosted on Amazon S3 buckets.
-
4.4.227 Sep 2020Release notes
Open source →- Fixed a handful of bugs related to using a custom table name when using a custom media class
-
4.4.114 Sep 2020 -
4.4.009 Sep 2020Release notes
Open source →- Added support for Laravel 8.0
- Dropping support for Laravel versions < 6.0
- Dropping support for PHP versions 7.2
-
4.3.217 Aug 2020Release notes
Open source →- Fix composer version constraint of
league/flysystemto allow minor version bumps - Removed redundant index from the Media table database migration
- Fix composer version constraint of
-
4.3.130 Jul 2020Release notes
Open source →Media::moveToDisk()andMedia::copyToDisk()now correctly transfer file visibility to the new disk.
-
4.3.028 Jul 2020 -
4.2.303 Jun 2020Release notes
Open source →- The
Media::$sizeproperty is now cast as int, fixing a TypeError. (Thanks @boumanb!) - Fixed
RemoteUrlAdapter,StreamAdapter, andStreamResourceAdapterpotentially returning an incorrect filename and/or extension if the query params of the URL contains certain characters.
- The
-
4.2.214 May 2020Release notes
Open source →- Fix bug with package auto-discovery with PHP 7.4
- Fix issue caused by a bug with doctrine/inflector 1.4.0
-
4.2.111 Mar 2020Release notes
Open source →- Replaced usage of the
getClientSize()method deprecated in Symphony 4.1 withgetSize()
- Replaced usage of the
-
4.2.007 Mar 2020 -
4.1.029 Feb 2020Release notes
Open source →- Fixed the timing of the beforeSave callback. Now occurs before onDuplicate validation occurs. This allows the callback to be used to determine where to place the file
- The beforeSave callback is now called triggered by the
MediaUploader::replace()andMediaUploader::import()methods as well
-
4.0.118 Feb 2020Release notes
Open source →- Added support for the new Symfony MimeTypes class in favor of the deprecated ExtensionGuesser (Thanks @crishoj!)
-
4.0.011 Oct 2019Release notes
Open source →- changed UrlGenerators to use the underlying filesystemAdapter's
url()method - UrlGenerators no longer throw
MediaUrlExceptionwhen the file does not have public visibility. This removes the need to read IO for files local disks or to make HTTP calls for files on s3 disks. - Removed
LocalUrlGenerator::getPublicPath() - No longer reading the
'prefix'config of local disks. Value should be included in the'url'config instead.
- changed UrlGenerators to use the underlying filesystemAdapter's
-
3.0.118 Sep 2019Release notes
Open source →- Fixed public visibility not being respected when generating URLs for local files that are not in the webroot.
-
3.0.016 Sep 2019Release notes
Open source →- Updated minimum support requirements to PHP 7.2 and Laravel 5.6+.
- Added PHP 7 parameter and return type hints across the board
- Added a new method
getStreamResourcetoSourceAdapterInterface, uploader will now attempt to use a stream to reduce memory usage. - Added
delete()method toMediableCollectionfor mass deleting media records and files. - Added support for file visibility on a file-by-file basis.
- Cleaned up test suite.
- fixed a number of docblocks
-
2.9.023 Mar 2019Release notes
Open source →- The name of the Mediables pivot table is now configurable (Thanks @nadinengland!)
-
2.8.208 Mar 2019 -
2.8.128 Jan 2019 -
2.8.021 Sep 2018Release notes
Open source →- Added update on duplicate behaviour to MediaUploader (Thanks @pet1330!)
- Fixed remote URL data source raising an error when headers cannot be read (Thanks @sebdesign!)
-
2.7.306 Jul 2018Release notes
Open source →- Return correct types in source adapter methods (Thanks @sebdesign!)
- Add docblocks for Media properties and query scopes (Thanks @sebdesign!)
-
2.7.204 Jul 2018 -
2.7.104 Jun 2018