Giter Site home page Giter Site logo

takaookano / cakephp-file-storage Goto Github PK

View Code? Open in Web Editor NEW

This project forked from burzum/cakephp-file-storage

0.0 0.0 0.0 1.86 MB

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.

License: MIT License

PHP 99.84% Ruby 0.16%

cakephp-file-storage's Introduction

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.

cakephp-file-storage's People

Contributors

burzum avatar robertpustulka avatar ravage84 avatar skie avatar dereuromark avatar mcallisto avatar steinkel avatar adnan0703 avatar choma avatar scrutinizer-auto-fixer avatar j15e avatar curtisgibby avatar bfncs avatar mhimmer avatar stonelasley avatar rifer avatar stripthis avatar bionicpimp avatar andrej-griniuk avatar ajibarra avatar d4rkmindz avatar guidohendriks avatar clawsonm avatar osazos avatar renan avatar thinkingmedia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.