• This repository has been archived on 05/Mar/2022
  • Stars
    star
    196
  • Rank 197,971 (Top 4 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 12 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Abstract file storage and upload plugin for CakePHP. Write to local disk, FTP, S3, Dropbox and more through a single interface. It's not just yet another uploader but a complete storage solution.

FileStorage Plugin for CakePHP

Software License Build Status Coverage Status Code Quality

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.

How it works

The whole plugin is build with clear Separation of Concerns (SoC) 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 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.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.

List of supported Adapters

  • Apc
  • Amazon S3
  • ACL Aware Amazon S3
  • Azure
  • Doctrine DBAL
  • Dropbox
  • Ftp
  • Grid FS
  • In Memory
  • Local File System
  • MogileFS
  • Open Cloud
  • Rackspace Cloudfiles
  • Sftp
  • Zip File

Supported CakePHP Versions

  • CakePHP 4.x -> 3.0 Branch
  • CakePHP 3.x -> 2.0 Branch
  • CakePHP 2.x -> 1.0 Branch

Requirements

  • PHP 7.2+
  • CakePHP 4.x
  • Gaufrette Storage Library 0.7.x

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.

Documentation

For documentation, as well as tutorials, see the docs directory of this repository.

Support

For bugs and feature requests, please use the issues section of this repository.

Contributing

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

  • Pull requests must be send to the branch that reflects the version you want to contribute to.
  • Unit tests are required.

License

Copyright Florian Krämer

Licensed under The MIT License Redistributions of files must retain the above copyright notice.

More Repositories

1

cakephp-imagine-plugin

CakePHP wrapper for the powerful Imagine image processing library. Makes images manipulation easy and powerful.
PHP
137
star
2

cakephp-service-layer

Service layer implementation for CakePHP
PHP
67
star
3

cakephp-html-purifier

This is a CakePHP wrapper for the HTML Purifier lib. The plugin includes a trait, a view helper, a behavior and a shell to clean your markup wherever you like, in the view or in the model layer or clean any table and field using the shell.
PHP
43
star
4

cakephp-user-tools

The UserTools plugin provides you the building blocks for everything around users. It comes with a CRUD kick start through the UserToolComponent and the UserBehavior. Just load the component and you have a working login and registration. Customize it as you like through configuration or use only what you really need.
PHP
42
star
5

cakephp-payments-plugin

Generic Payment Interface. Thought to be used by all payment processors implemented for CakePHP. It might get also a non CakePHP specific branch.
PHP
19
star
6

cakephp-bz-utils

CakePHP 2.x Utilities
PHP
15
star
7

ddd-invoice-domain-example

PHP
13
star
8

cakephp-middleware-auth

Replacement of the old authentication stack of the CakePHP framework
PHP
9
star
9

CartSampleApp

Sample Application for the CakePHP Cart plugin: http://github.com/burzum/Cart
PHP
7
star
10

cakephp-simple-rbac

Easy to use and configure RBAC authorization adapter for CakePHP.
PHP
5
star
11

Sofort

Sofortüberweisung Payment Processor for CakePHP
PHP
4
star
12

hexagonal-cake

Hexagonal Architecture Application with CakePHP and a DIC - Could be used as a template in theory but for now its a learning project
PHP
4
star
13

cakephp-serialize-data-types

Serialize-able data types for the CakePHP ORM
PHP
2
star
14

fast-route-middleware

A convenient and strict typed Fast Route middleware implementation.
PHP
2
star
15

cakephp-database-log

CakePHP Database Log Engine. An implementation of the DB Log Engine from the official documentation.
PHP
2
star
16

cakephp-zurb-inky

Zurb Inky support for the CakePHP Framework
PHP
1
star
17

CakePHP-ModelViz-Plugin

Plugin that generates a Graphviz output that can be used to render a diagram of the model associations.
1
star
18

vue-comments

Comments widget like FB or Disqus based on Vue.js
JavaScript
1
star
19

storage-factory

A Storage Factory Library for Flysystem and Gaufrette
PHP
1
star
20

cakephp-config-objects

Configuratio objects instead of arrays. Check the readme.md to learn about the benefits.
PHP
1
star