burzum / cakephp-file-storage

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.
MIT License
197 stars 84 forks source link

updating docs #195

Closed waspinator closed 5 years ago

waspinator commented 5 years ago

Thanks for working on this file plugin, it looks well designed.

I'm having issues installing it though. I'm using cake 3.8, so I assume I need version 2. This is what I've tried.

composer require burzum/file-storage:2.0.*
bin/cake plugin load Burzum/FileStorage
bin/cake migrations migrate --plugin Burzum/FileStorage

this produces a deprecation error

Deprecated Error: Checking a single plugin with Plugin::loaded() is deprecated. Use Plugin::isLoaded() instead. - /app/vendor/burzum/file-storage/config/bootstrap.php, line: 11

After editing config/bootstrap.php with

use Cake\Event\EventManager;
use Burzum\FileStorage\Lib\FileStorageUtils;
use Burzum\FileStorage\Lib\StorageManager;
use Burzum\FileStorage\Event\ImageProcessingListener;
use Burzum\FileStorage\Event\LocalFileStorageListener;

$listener = new LocalFileStorageListener();
EventManager::instance()->on($listener);

I get the following exception:

Exception: Class 'Burzum\FileStorage\Event\LocalFileStorageListener' not found in [/app/config/bootstrap.php, line 202]
ravage84 commented 5 years ago

With composer require burzum/file-storage:2.0.* you get anything like 2.0.x, but version 2.1.0 has been released, which provides CakePHP 3.6+ support.

Docs fixed in https://github.com/burzum/cakephp-file-storage/commit/97ba39fc07ff7282d6a240e1fe5fef3c7912418a

Please update and re-try.

waspinator commented 5 years ago

I updated to 2.1 and the deprecation warning has gone away, but I still get the exception after editing the config/bootstrap.php file.

It looks like the Lib directory was removed but the docs still reference it.

jaygoodswp commented 4 years ago

@waspinator

use Cake\Event\EventManager;
use Burzum\FileStorage\Storage\StorageUtils;
use Burzum\FileStorage\Storage\StorageManager;
use Burzum\FileStorage\Storage\Listener\ImageProcessingListener;
use Burzum\FileStorage\Storage\Listener\LocalListener;

$listener = new LocalListener();
EventManager::instance()->on($listener);

// automated image processing
$listener = new ImageProcessingListener();
EventManager::instance()->on($listener);

StorageManager::config('Local', [
    'adapterOptions' => [ROOT . DS . 'file_storage', true],
    'adapterClass' => '\Gaufrette\Adapter\Local',
    'class' => '\Gaufrette\Filesystem'
]);