PHPackages                             dereuromark/cakephp-file-storage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. dereuromark/cakephp-file-storage

ActiveCakephp-plugin[File &amp; Storage](/categories/file-storage)

dereuromark/cakephp-file-storage
================================

This plugin is giving you the possibility to store files in virtually any kind of storage backend. This plugin is wrapping the Gaufrette library (https://github.com/KnpLabs/Gaufrette) library in a CakePHP fashion and provides a simple way to use the storage adapters through the StorageManager class.

4.4.0(1mo ago)106.1k3[1 issues](https://github.com/dereuromark/cakephp-file-storage/issues)[2 PRs](https://github.com/dereuromark/cakephp-file-storage/pulls)MITPHPPHP &gt;=8.2CI failing

Since Jul 23Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/dereuromark/cakephp-file-storage)[ Packagist](https://packagist.org/packages/dereuromark/cakephp-file-storage)[ Docs](https://github.com/dereuromark/cakephp-file-storage)[ RSS](/packages/dereuromark-cakephp-file-storage/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (21)Versions (56)Used By (0)

FileStorage Plugin for CakePHP
==============================

[](#filestorage-plugin-for-cakephp)

[![CI](https://github.com/dereuromark/cakephp-file-storage/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/dereuromark/cakephp-file-storage/actions/workflows/ci.yml?query=branch%3Amaster)[![codecov](https://camo.githubusercontent.com/9581ac739dd7a955d0813f8bfaab8896952da3bf01fd8af07322f13fcc656e1b/68747470733a2f2f636f6465636f762e696f2f67682f6465726575726f6d61726b2f63616b657068702d66696c652d73746f726167652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://app.codecov.io/gh/dereuromark/cakephp-file-storage/tree/master)[![PHPStan](https://camo.githubusercontent.com/f60d96f7c2579690ab6dfa8918f777fe93a02a92301c661eb38a85861a92b780/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d627269676874677265656e2e7376673f7374796c653d666c6174)](https://phpstan.org/)[![Latest Stable Version](https://camo.githubusercontent.com/61cfc383616d07416b0b5f1cda22884c9cd270e0285c4d3cd47f94ce5d298cda/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f63616b657068702d66696c652d73746f726167652f762f737461626c652e737667)](https://packagist.org/packages/dereuromark/cakephp-file-storage)[![Minimum PHP Version](https://camo.githubusercontent.com/ec21f169d70b69344c67d6f18fa1a24d20476d2f0cd680e8c4a1534c22f34e5f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e322d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/0d132a6ca35c71258f058680043f0fdece9a9144b6b78c8817ceef17e1e90ddb/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f63616b657068702d66696c652d73746f726167652f642f746f74616c2e737667)](https://packagist.org/packages/dereuromark/cakephp-file-storage)[![Coding Standards](https://camo.githubusercontent.com/7d06840986f78de39fb7ba7052db7208fb349427094ac1a4540449ca87776aff/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f63732d506870436f6c6c6563746976652d707572706c652e7376673f7374796c653d666c61742d737175617265)](https://github.com/php-collective/code-sniffer)

The **FileStorage** plugin is giving you the possibility to upload and store files in virtually any kind of storage backend. The plugin features the [FlySystem](https://github.com/thephpleague/flysystem) library in a CakePHP fashion and provides a simple way to use the storage adapters.

Storage adapters are a 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.

This branch is for use with **CakePHP 5.1+**. See [version map](https://github.com/dereuromark/cakephp-file-storage/wiki#cakephp-version-map) for details.

How it works
------------

[](#how-it-works)

The whole plugin is build with clear [Separation of Concerns (SoC)](https://en.wikipedia.org/wiki/Separation_of_concerns) in mind: A file is *always* an entry in the `file_storage` table 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_storage` table with your model using the FileStorage 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.file` for 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.

Admin backend
-------------

[](#admin-backend)

The plugin ships a self-contained admin backend at `/admin/file-storage`(dashboard, file listing with bulk delete, storage cleanup UI). It is **fail-closed by default** — set `FileStorage.adminAccess` (`true` or a `Closure(\Cake\Http\ServerRequest): bool`) to opt in. The bundled Bootstrap 5 layout can be replaced with your host app's layout via `FileStorage.adminLayout`. See the [Admin Backend docs](https://dereuromark.github.io/cakephp-file-storage/admin/).

For background image-variant regeneration from the admin UI, install [`dereuromark/cakephp-queue`](https://github.com/dereuromark/cakephp-queue); without it the regenerate buttons render disabled.

Note

Do not pre-fill the primary key on a FileStorage entity before saving. Path generation runs through the `php-collective/file-storage` UUID strategy; if a caller hands it a pre-set id, two concurrent saves with the same id would race on `fileStorage->store()`. Let the table assign the id.

Documentation
-------------

[](#documentation)

Full documentation lives at **[dereuromark.github.io/cakephp-file-storage](https://dereuromark.github.io/cakephp-file-storage/)**.

A few good entry points:

- [Getting started](https://dereuromark.github.io/cakephp-file-storage/guide/)
- [Quick Start tutorial](https://dereuromark.github.io/cakephp-file-storage/guide/quick-start)
- [Serving files and authorization](https://dereuromark.github.io/cakephp-file-storage/serving/)
- [Configuration reference](https://dereuromark.github.io/cakephp-file-storage/reference/)

The Markdown sources live in the [docs](docs/) directory of this repository.

Support
-------

[](#support)

For bugs and feature requests, please use the [issues](https://github.com/dereuromark/cakephp-file-storage/issues) section of this repository.

Contributing
------------

[](#contributing)

To contribute to this plugin please follow a few basic rules.

- Pull requests must be sent to the branch that reflects the version you want to contribute to.
- [Unit tests](http://book.cakephp.org/5/en/development/testing.html) are required.

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity89

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~106 days

Recently: every ~31 days

Total

45

Last Release

52d ago

Major Versions

0.5.2 → 1.0.0-RC12015-05-03

1.1.6 → 2.0.0-alpha12017-01-12

1.2.1 → 2.0.0-beta12017-11-24

2.1.0 → 3.0.0-alpha2022-10-19

3.0.0 → 4.0.0-beta2023-11-20

PHP version history (6 changes)0.3.2PHP &gt;=5.3.2

1.0.0-RC1PHP &gt;=5.4.19

2.0.0-beta2PHP &gt;=7.0.0

3.0.0-alphaPHP &gt;=7.4

4.0.0-betaPHP &gt;=8.1

4.1.1PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39854?v=4)[Mark Scherer](/maintainers/dereuromark)[@dereuromark](https://github.com/dereuromark)

---

Top Contributors

[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (177 commits)")[![burzum](https://avatars.githubusercontent.com/u/162789?v=4)](https://github.com/burzum "burzum (112 commits)")[![robertpustulka](https://avatars.githubusercontent.com/u/7437773?v=4)](https://github.com/robertpustulka "robertpustulka (67 commits)")[![ravage84](https://avatars.githubusercontent.com/u/625761?v=4)](https://github.com/ravage84 "ravage84 (55 commits)")[![skie](https://avatars.githubusercontent.com/u/130799?v=4)](https://github.com/skie "skie (14 commits)")[![mcallisto](https://avatars.githubusercontent.com/u/122379?v=4)](https://github.com/mcallisto "mcallisto (9 commits)")[![steinkel](https://avatars.githubusercontent.com/u/151761?v=4)](https://github.com/steinkel "steinkel (8 commits)")[![Adnan0703](https://avatars.githubusercontent.com/u/6469288?v=4)](https://github.com/Adnan0703 "Adnan0703 (7 commits)")[![choma](https://avatars.githubusercontent.com/u/4775453?v=4)](https://github.com/choma "choma (6 commits)")[![j15e](https://avatars.githubusercontent.com/u/143380?v=4)](https://github.com/j15e "j15e (5 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (5 commits)")[![bfncs](https://avatars.githubusercontent.com/u/1049882?v=4)](https://github.com/bfncs "bfncs (3 commits)")[![stripthis](https://avatars.githubusercontent.com/u/77410?v=4)](https://github.com/stripthis "stripthis (2 commits)")[![mhimmer](https://avatars.githubusercontent.com/u/199251?v=4)](https://github.com/mhimmer "mhimmer (2 commits)")[![BionicPimp](https://avatars.githubusercontent.com/u/2127533?v=4)](https://github.com/BionicPimp "BionicPimp (2 commits)")[![rifer](https://avatars.githubusercontent.com/u/13977524?v=4)](https://github.com/rifer "rifer (2 commits)")[![andrej-griniuk](https://avatars.githubusercontent.com/u/2722793?v=4)](https://github.com/andrej-griniuk "andrej-griniuk (2 commits)")[![ajibarra](https://avatars.githubusercontent.com/u/794722?v=4)](https://github.com/ajibarra "ajibarra (2 commits)")[![stonelasley](https://avatars.githubusercontent.com/u/1717836?v=4)](https://github.com/stonelasley "stonelasley (2 commits)")[![thinkingmedia](https://avatars.githubusercontent.com/u/551022?v=4)](https://github.com/thinkingmedia "thinkingmedia (1 commits)")

---

Tags

abstractioncakephpcakephp-pluginfilesystemphpstorageuploadfilesystemabstractioncakephpfilestoragemediauploadadmin-panel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dereuromark-cakephp-file-storage/health.svg)

```
[![Health](https://phpackages.com/badges/dereuromark-cakephp-file-storage/health.svg)](https://phpackages.com/packages/dereuromark-cakephp-file-storage)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k41.5M133](/packages/knplabs-gaufrette)[dereuromark/cakephp-queue

The Queue plugin for CakePHP provides deferred task execution.

308954.9k25](/packages/dereuromark-cakephp-queue)[knplabs/knp-gaufrette-bundle

Allows to easily use the Gaufrette library in a Symfony project

72430.0M103](/packages/knplabs-knp-gaufrette-bundle)[cakephp/bake

Bake plugin for CakePHP

11212.0M199](/packages/cakephp-bake)[torann/mediasort

Attachment manager for Laravel.

2212.5k](/packages/torann-mediasort)[burriko/cake-file-storage

A basic file storage behavior for CakePHP. Handles storing uploaded files in database or file system.

101.1k](/packages/burriko-cake-file-storage)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
