PHP code example of atellitech / flysystem-yii2

1. Go to this page and download the library: Download atellitech/flysystem-yii2 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/ */

    

atellitech / flysystem-yii2 example snippets

=
...
"components": [
    "fs" => [
        'class' => 'AtelliTech\\Yii2\\FlysystemAdapterLocal',
        'rootPath' => '@runtime', // support alias name of Yii2 or defined in configuration,
        'visibility' => [ // see https://flysystem.thephpleague.com/docs/visibility/
                'file' => [
                    'public' => 0640,
                    'private' => 0604,
                ],
                'dir' => [
                    'public' => 0740,
                    'private' => 7604,
                ],
            ],
        'writeFlag' => LOCK_EX, // see https://www.php.net/manual/en/function.flock.php
        'linkMode' => 2 // see https://github.com/thephpleague/flysystem/blob/3.x/src/Local/LocalFilesystemAdapter.php#L54
    ]
]
=
...
"components": [
    "fs" => [
        'class' => 'AtelliTech\\Yii2\\FlysystemAdapterInMemory'
    ]
]
=
...
"components": [
    "fs" => [
        'class' => 'AtelliTech\\Yii2\\FlysystemAdapterSftpV3',
        'rootPath' => '/home/xxx',
        'host' => 'xxx', // host (teKey' => null, // private key (optional, default: null) can be used instead of password, set to null if password is set
        'passphrase' => null, // passphrase (optional, default: null), set to null if privateKey is not used or has no passphrase
        'port' => 22, // port (optional, default: 22)
        'useAgent' => false, // use agent (optional, default: false)
        'timeout' => 30, // timeout (optional, default: 30)
        'maxTries' => 4, // max tries (optional, default: 4)
        'hostFingerprint' => null, // host fingerprint (optional, default: null),
        'connectivity' => null, // connectivity checker (must be an implementation of 'League\Flysystem\PhpseclibV2\ConnectivityChecker' to check if a connection can be established (optional, omit if you don't need some special handling for setting reliable connections)
        'visibility' [ // see https://flysystem.thephpleague.com/docs/visibility/
                'file' => [
                    'public' => 0640,
                    'private' => 0604,
                ],
                'dir' => [
                    'public' => 0740,
                    'private' => 7604,
                ],
            ],
    ]
]