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 Composer projects
Warning
To run phpdocx with Composer it is mandatory to use the package that supports namespaces. This package is available for Advanced and Premium licenses.
Composer has become the default dependency manager for PHP. It has simplified the creation of new projects thanks to its automatic download of dependencies and a thorough version control of packages.
The type of licenses of phpdocx disallow the existence of a package in public repositories, like Packagist.
The installation of phpdocx in a project that works with Composer can be manual or using a private repository, e.g., GitHub or Bitbucket. phpdocx licenses allow code editing but no redistribution.
To perform a manual integration just follow these three easy steps:
- 1- Download the package with support for namespaces from the MY PHPDOCX page. Unzip the complete package in a subfolder inside vendor or the route you use for third parties libraries, e.g., vendor/phpdocx.
- 2- Open the file composer.json and add the following classmap in the autoload section:
- 3- Go to the root of the project and update the Composer autoloader:
That's all you need to have your library fresh and ready to use it from your project, for example, creating a document with text:
In order to use a private repository with GitHub or Bitbucket you have to generate and use an SSH key:
- GitHub: https://stackoverflow.com/questions/40619393/how-to-add-private-github-repository-as-composer-dependency
- Bitbucket: https://dev.to/minompi/using-a-bitbucket-private-repository-in-your-projects-24j9
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.