Integrate phpdocx with Symfony 2, Symfony 3 and Symfony 4
To run phpdocx with Symfony 2 or Symfony 3 or Symfony 4 it is mandatory to use the package that supports namespaces. This package is available for Advanced and Premium licenses.
- 1- Copy the content of the phpdocx package in the folder vendor/phpdocx.
- 2- Open the file composer.json. Add the following classmap in the autoload section:
In a Symfony 4 clean installation, the section should look like this:
- 3- Update the autoloader of Composer:
Now, with these three easy steps completed, you can work with phpdocx.
As an example, let's create a document in a controller and then save it in a public folder with the name output.docx: