Cookbook
- Learn phpdocx in 5 minutes
- Tutorial
- API quick guide
- HTML to Word
- HTML Extended
- Conversion plugin
- Word to HTML
- DOCXPath
- Bulk processing
- DOCXCustomizer
- Digital signature
- Cryptophpdocx
- Right to left languages
- phpdocx CLI command
- Tracking
- Artificial Intelligence
- Blockchain for documents
- JavaScript API
- Compiled mode
Integrate phpdocx with Yii
Warning
To run phpdocx with Yii it is mandatory to use the package that supports namespaces. This package is available for Advanced and Premium licenses.
The installation of phpdocx in a project that works with Composer can be manual or using a private repository with GitHub, Bitbucket or any other distributed version control system.
To use a private repository with GitHub, Bitbucket or Gitlab you have to generate and use an SSH key or auth.json:
- GitHub: https://dudi.dev/composer-private-packages-github-repository
- Bitbucket: https://dev.to/minompi/using-a-bitbucket-private-repository-in-your-projects-24j9
- GitLab: https://docs.gitlab.com/user/packages/composer_repository/#install-a-composer-package
Advanced and Premium licenses include a sample composer.json file (plugins/sample_composer.json file in the namespaces package) that can be added in a phpdocx private repository.
To perform a manual integration just follow these three easy steps:
- 1- Copy the content of the phpdocx package in the folder you use for third parties libraries, e.g. lib/phpdocx, vendor/phpdocx or 3rd-party/phpdocx.
- 2- Open the file composer.json and add the following classmap in the autoload section: "lib/phpdocx/Classes/Phpdocx" . Replacing lib/phpdocx with the folder name where phpdocx has been copied.
- 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 the webroot folder with the name output.docx: