PHP code example of netzmacht / contao-flysystem

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

    

netzmacht / contao-flysystem example snippets


$ php composer.phar 



// First get the mount manager to get the file system.
$manager    = $GLOBALS['container']['flysystem.mount-manager'];
$fileSystem = $manager->getFilesystem('local');

// Alternatively use the FlysystemTrait
class MyContentElement
{
   use Netzmacht\Contao\Flysystem\Integration\FlysystemTrait;
   
   protected function compile()
   {
      $fileSystem = $this->getMountManager()->getFilesystem('local');
   }
}


 
$manager    = $GLOBALS['container']['flysystem.mount-manager'];
$fileSystem = $manager->getFilesystem('dbafs');

// Get file path.
$metadata = $fileSystem->getMetadata('files/path/to/file');

// Get file by binary uuid.
$metadata = $fileSystem->getMetadata($this->multiSRC);

// Get file by binary uuid.
$metadata = $fileSystem->getMetadata(\String::binToUuid($this->multiSRC));