I have tried to add around plugin on Magento\Framework\Filesystem\Driver\File::readDirectory method but couldn't succeed.

<type name="Magento\Framework\Filesystem\Driver\File">
    <plugin name="plugin-name" type="[VENDOR]\[MODULE]\Plugin\FilePlugin"  />

Here is my plugin class

class FilePlugin {

private $config;

public function __construct(Config $config)
    $this->config = $config;

public function aroundReadDirectory(Subject $subject, callable $proceed, $path)
    $results = $proceed($path);

    return $results;

is it possible to add the plugin for Magento\Framework\Filesystem\Driver\File class?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.