Skip to content

pronego/kohana-storage-flysystem

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Kohana Storage

NOT 100% TESTED YET / NOT FOR PRODUCTION

A Kohana module for using the Flysystem package to abstract storage http://flysystem.thephpleague.com/docs/

  1. Installation
  2. Configuration
  3. Usage

Installation

Go to your main folder and use composer to install Flysystem

composer require league/flysystem ~1.0, ships with local (default) and /dev/null

Then install some adapters that you intend to use

  • AWS S3 composer require league/flysystem-aws-s3-v3
    • For performance, install the cached adapter composer require league/flysystem-cached-adapter
  • Azure composer require league/flysystem-azure-blob-storage
  • DigitalOcean Spaces composer require league/flysystem-aws-s3-v3 (same as S3)
  • Memory composer require league/flysystem-memory
  • SFTP composer require league/flysystem-sftp

Download package in modules folder modules/kohana-storage

Enable in the module

Kohana::modules([
    ...
    'storage' => 'modules/kohana-storage',
    ...
]);

Configuration

Copy config/storage.php to application/config/storage.php

Usage

Use the default disk

  • Storage::instance()->write('file.txt', 'Contents');
  • In production, this should point to your main filesystem like s3

Use the local disk (for quick saves to local)

  • Storage::local()->write('file.txt', 'Contents');
  • Need to make sure 'local' is configured like in the default config file

Specify a disk to use

  • Storage::instance('local')->put('file.txt', 'Contents');
  • Storage::instance('s3')->put('file.txt', 'Contents');

Flysystem API documentation

https://flysystem.thephpleague.com/docs/usage/filesystem-api/

TODO

About

Kohana module that wraps Flysystem

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%