PHPWord icon indicating copy to clipboard operation
PHPWord copied to clipboard

TemplateProcessor can accept a file contents instead of the file path

Open Adesin-fr opened this issue 4 years ago • 0 comments

Description

In many projects, Devs are now using Cloud storage (such as AWS S3). So, having a word template in a S3 storage would force the dev to save it to a custom/temporary path and then give the path to the TemplateProcessor constructor.

I submit this PR so the constructor can ALSO accept the file contents. If the given parameter is a path to a valid file, then the constructor works as before. Else, we suppose that the parameter contains the file contents, and then we save it to the tempDocumentFilename, and use it as we did before.

Checklist:

  • [x] I have run composer run-script check --timeout=0 and no errors were reported
  • [x] The new code is covered by unit tests (check build/coverage for coverage report)
  • [x] I have updated the documentation to describe the changes

Adesin-fr avatar Jul 27 '21 08:07 Adesin-fr