Download the PHP package mohammedmanssour/file-cast without Composer
On this page you can find all versions of the php package mohammedmanssour/file-cast. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mohammedmanssour/file-cast
More information about mohammedmanssour/file-cast
Files in mohammedmanssour/file-cast
Package file-cast
Short Description Easily manage uploaded files in your Laravel app, with automatic path saving and handy value objects for effortless access.
License MIT
Homepage https://github.com/mohammedmanssour/file-cast
Informations about the package file-cast
File Cast
This Laravel package makes file management straightforward. It automatically saves uploaded files to the disk and stores their paths in the database. When you retrieve these files, it wraps the paths in easy-to-use value objects. The package also keeps track of any changes, ensuring old files are deleted when updates occur. It’s a simple way to keep your file handling neat and efficient.
Features
- Mapping uploaded files from the Request to the Model.
- Old files are automatically deleted upon model update or deletion.
- File Value Object for easy access
Installation
You can install the package via composer:
You can publish the config file with:
Usage
-
Add the
FileCast
to your casts list -
Optional, if you want to clean old files upon model update or delete, add the following observer to your model
- On Model Retrieval, the casted attribute is converted to a file object that provides the following method
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
- Mohammed Manssour
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of file-cast with dependencies
spatie/laravel-package-tools Version ^1.16
laravel/framework Version ^10.0|^11.0