2017 © Pedro Peláez
 

yii2-extension yii2-flysystem

Yii2 Flysystem Component

image

airani/yii2-flysystem

Yii2 Flysystem Component

  • Friday, August 18, 2017
  • by airani
  • Repository
  • 1 Watchers
  • 5 Stars
  • 52 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

Yii2 Flysystem Component

The Flysystem component for Yii2 PHP framework with more flexibility than similar components and integrated with Flysystem MountManager and returns Flysystem objects as Yii2 component that helps to work with other libraries integrated with Flysystem like Glide ., (*1)

Installation

The preferred way to install this extension is through composer ., (*2)

Either run, (*3)

composer require airani/yii2-flysystem

or add, (*4)

"airani/yii2-flysystem": "~1.0"

to the require section of your composer.json file., (*5)

Configuring

Configure application components for any of filesystem adapter as follows, (*6)

return [
    // ...
    'componenets' => [
        // ...
        'flysystem' => [
            'class' => 'airani\flysystem\MountManager',
            'localFs' => [ // https://flysystem.thephpleague.com/adapter/local/
                'class' => 'League\Flysystem\Adapter\Local',
                'root' => __DIR__.'/path/to/too',
            ],
            'ftpFs' => [ // https://flysystem.thephpleague.com/adapter/ftp/
                'class' => 'League\Flysystem\Adapter\Ftp',
                'config' => [
                    'host' => 'ftp.example.com',
                    'username' => 'username',
                    'password' => 'password',

                    // optional config settings
                    'port' => 21,
                    'root' => '/path/to/root',
                    'passive' => true,
                    'ssl' => true,
                    'timeout' => 30,
                ],
            ],
            // and config other filesystem adapters
            // read adapters section of flysystem guide https://flysystem.thephpleague.com
        ],
    ],
];

Usage

To work with MountManager :, (*7)

// Read from FTP
$contents = Yii::$app->flysystem->read('ftp://some/file.txt');

// And write to local
Yii::$app->flysystem->write('local://put/it/here.txt', $contents);

Or simple usage:, (*8)

Yii::$app->filesystem->localFs->write('path/to/file.txt', 'contents');

for how to work with flysystem read this api documentation ., (*9)

The Versions

18/08 2017

v1.0

1.0.0.0

Yii2 Flysystem Component

  Sources   Download

BSD-3-Clause

The Requires

 

by Ali Irani

filesystem component yii2 flysystem

18/08 2017

dev-master

9999999-dev

Yii2 Flysystem Component

  Sources   Download

BSD-3-Clause

The Requires

 

by Ali Irani

filesystem component yii2 flysystem