wearesho-team/yii2-filesystem

Yii2 integration for league/flysystem

5.1.0 2024-12-16 14:51 UTC

README

Test & Lint Latest Stable Version Total Downloads codecov License

Integration of league/flysystem for Yii2.

It is configured by environment variables by default. Available integration out-of-box:

  • Local - should be used for development
  • S3 - should be used in production

Configuring

By-default configuring available using environment variables. To choose which integration to use you need to configure FILESYSTEM_ADAPTER variable. Available values: local, s3. (or another, if you use custom bootstrap configuration)

Configuring S3 adapter

Configuring Local adapter

Usage

Bootstrap

To start use this package out-of-box you need to append Bootstrap into your Yii2 application.

<?php

// common/config/main.php or another configuration file

use Wearesho\Yii\Filesystem;

return [
    'components' => [
        // ...
    ],
    'bootstrap' => [
        'class' => Filesystem\Bootstrap::class,
        'container' => true, // if you need to configure global DI container (\Yii::$container)
        'id' => 'fs', // \Yii::$app component to be configured. Filesystem will be available using \Yii::$app->fs
    ],
];

Note: for advanced usage you may customize Bootstrap adapters and config properties

TODO

  • Tests

License

MIT