Forum


Replies: 9   Views: 1820
How to use the streammode?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 02-04-2021 - 15:26

Hello,

Sorry but we don't have a sample about using the stream mode with Laravel, as each version of Laravel may vary from the method to be used to return a stream response (the same applies to other frameworks/CMS: Symfony, Yii, Drupal, WordPress...).

phpdocx generates a standard stream output when using CreateDocx::$streamMode, so the CMS/framework/custom code can handle it, but the exact internal method/object/class depends on each CMS/framework/code version. We recommend you to check the documentation for the Laravel version you are using, for example it seems that some people use a stream method from Laravel Response object: https://stackoverflow.com/questions/58989925/laravel-response-stream-download-returns-empty-file. We also recommend you opening the DOCX output with an HEX viewer so you can check what extra content is being added to the DOCX by the framework you are using, maybe some extra information from the Response object.

For example, on https://www.phpdocx.com/en/forum/default/topic/1463 you can see a very similar case working with Symfony and download the DOCX. The code doesn't use the stream mode from phpdocx, but using a not correct Response with Symfony added extra contents to the DOCX output.

Regards.