convertToText(); $convertor = new TextConvertor($this->storage, "$this->directoryPath/document.txt"); $convertor->execute(); } /** * Convert docx file to text * * @return void */ protected function convertToText() { (new Process(['export HOME=' . env('USER_HOME_PATH')]))->run(); $process = new Process([ 'soffice', '--headless', '--convert-to', 'txt', $this->storage->path($this->path), '--outdir', $this->storage->path($this->directoryPath) ]); $process->run(); if (!$process->isSuccessful()) { throw new ProcessFailedException($process); } $this->deleteOriginalDocument(); } }