I'm using Laravel for my school project and recently found the PHPOffice library. I found some examples in the documentation but I still can't understand how to cope it with Laravel. Installed it with composer and now I want to read some *.docx file. Does someone know how to achieve that? I used this
class ShareController extends Controller {
public function share($hashed_name){
$ds = DIRECTORY_SEPARATOR;
$userid = Auth::id();
$name = basename(__FILE__, '.php');
$source = storage_path('uploads\\'.$userid.'\\'.$onlyFilename.'_0.docx');
echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
$phpWord = IOFactory::load($source);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}
}
But I get
Whoops, looks like something went wrong.
1/1 ErrorException in ShareController.php line 34: Use of undefined constant EOL - assumed 'EOL'