This package is abandoned and no longer maintained. The author suggests using the oneup/flysystem-bundle package instead.

This integrates the flysystem filesystem abstraction into Contao

1.0.0-beta1 2015-09-26 15:41 UTC

This package is auto-updated.

Last update: 2022-02-01 12:51:39 UTC


Build Status Version License Downloads Contao Community Alliance coding standard

This library integrates the flysystem filesystem abstraction into Contao.

It provides a fully configured filesystem service for TL_ROOT and an adapter for the Dbafs of Contao!


You can install this library using Composer. It requires at least PHP 5.4 and Contao 3.2.

$ php composer.phar require netzmacht/contao-flysystem:~1.0


  • Filesystem abstraction for whole Contao installation
  • Dbafs adapter
  • Metadata caching


Access to the mount manager and the default file system


// 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');

Dbafs file system

For the dbafs filesystem exists an separate filesystem adapter. It allows to fetch files by path or uuid. The meta data is enriched with model details id, uuid, hash, meta, importantPart.

It keeps the dbafs in sync when performing file system actions.

$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));

Note: You have to prepend the file path with the upload path as this is the Contao standard. If you try to access a file out of the upload path scope you'll get an RootViolationException.