Abstract file storage and upload plugin for CakePHP. Write to local disk, FTP, S3, Dropbox and more ...
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
If you're upgrading from CakePHP 2.x please read the migration guide.
The File Storage plugin is giving you the possibility to upload and store files in virtually any kind of storage backend. The plugin features the Gaufrette and FlySystem library in a CakePHP fashion and provides a simple way to use the storage adapters through the StorageManager class.
Storage adapters are an unified interface that allow you to store file data to your local file system, in memory, in a database or into a zip file and remote systems. There is a database table keeping track of what you stored where. You can always write your own adapter or extend and overload existing ones.
The whole plugin is build with clear Separation of Concerns (SoC) in mind: A file is always an entry in the
file_storagetable from the app perspective. The table is the reference to the real place of where the file is stored and keeps some meta information like mime type, filename, file hash (optional) and size as well. Storing the path to a file inside an arbitrary table along other data is considered as bad practice because it doesn't respect SoC from an architecture perspective but many people do it this way for some reason.
You associate the
file_storagetable with your model using the FileStorage or ImageStorage model from the plugin via hasOne, hasMany or HABTM. When you upload a file you save it to the FileStorage model through the associations,
Documents.filefor example. The FileStorage model dispatches then file storage specific events, the listeners listening to these events process the file and put it in the configured storage backend using adapters for different backends and build the storage path using a path builder class.
Optional but required if you want image processing out of the box:
You can still implement whatever file processing you want very easy. It's not tied to Imagine.
For documentation, as well as tutorials, see the docs directory of this repository.
For bugs and feature requests, please use the issues section of this repository.
To contribute to this plugin please follow a few basic rules.
Copyright Florian Krämer
Licensed under The MIT License Redistributions of files must retain the above copyright notice.