PHP code example of consik / yii2-flysystem

1. Go to this page and download the library: Download consik/yii2-flysystem library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

consik / yii2-flysystem example snippets


//config/web.php for simple application
'components' => [
    ... 
    'localFiles' => [
        'class' => consik\yii2flysystem\Filesystem::class,
        'adapter' => \League\Flysystem\Adapter\Local::class,
        'adapterParams' => [
            __DIR__ //first argument for Local adapter constructor is root dir
        ],
        'plugins' => [
            \League\Flysystem\Plugin\ListFiles::class
        ]
        //'config' => [] //\League\Flysystem\Filesystem config param
    ]
    ...
]

\Yii::$app->localFiles->listFiles();
...etc

'components' => [
    ... 
    'ftp' => [
        'class' => consik\yii2flysystem\Filesystem::class,
        'adapter' => \League\Flysystem\Adapter\Ftp::class,
        'adapterParams' => [
            [ //for FTP constructor first param is configuration array
                'host' => 'your.ftp.host',
                'username' => 'username',
                'password' => 'password'
            ]
        ],
        'plugins' => [
            \League\Flysystem\Plugin\ListFiles::class
        ]
    ]
    ...
]