Download the PHP package nowo-tech/word-template-bundle without Composer

On this page you can find all versions of the php package nowo-tech/word-template-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package word-template-bundle

WordTemplateBundle

CI Packagist Version Packagist Downloads

Found this useful? Install from Packagist (composer require nowo-tech/word-template-bundle) and consider starring WordTemplateBundle on GitHub.

Symfony bundle that fills Microsoft Word .docx templates (PHPWord TemplateProcessor) using a PHP context array:

Conditionals

Two ways to keep or remove part of a document — both in the same template if you like:

Named block (decided in PHP) Expression (decided in the template, 1.8 opt-in)
In Word ${#if annex} … ${#endif annex} ${#if total > 1000} … ${#endif}
In PHP 'annex' => new ConditionalBlock('annex', $hasAnnex) 'total' => $order->total()
Enable always on nowo_word_template.conditional_expressions.enabled: true
Branches — (two blocks with opposite decisions) ${#elseif total > 100} … ${#else} … ${#endif} (1.9)

In Word (each marker in its own paragraph):

In PHP:

Result: Invoice F-2026-001 · Orders above 1,000 EUR ship for free within Spain. · Please pay before 2026-11-15.

Expressions use Symfony ExpressionLanguage syntax with no access to PHP functions, constants or objects — only the context values and a whitelist of Twig-like functions (lower, upper, trim, length, replace, round, number_format, join, default, is_defined, now, date, …; your own via a tagged provider). Errors (typos, unknown variables) throw ConditionalExpressionException by default. Word's typographic quotes are handled. Full reference: USAGE — Conditionals by data type for named blocks.

Rendered by the demo (make docx-previews, LibreOffice) — template in Word → generated document:

Expression true / false Nested blocks "Else" pair
One of N Table only when there are rows Functions
Named block (PHP) Dates

Loops

(1.8, opt-in: nowo_word_template.loops.enabled: true) — repeat paragraphs, or whole table rows when the markers sit in rows of their own:

In Word (each | line is a table row):

In PHP:

Result: one row per line (1 | Anchor bolts | 40, 2 | Brackets | 25.5), then Total | | 65.5.

Twig-like loop.index, index0, revindex, first, last, length, parent; ${#for key, value in map}; ${#if …} and nested loops inside the body see the loop variables; iteration caps protect workers. Full reference: USAGE — Loops.

Invoice rows + conditional row Nested loops Loop variables

Demo pages (demo/symfony8):

Template form Conditionals (named + expression decisions) Expression examples (Word / PHP / result) Loops

This bundle is FrankenPHP worker mode friendly.

It stays safe in kernel-not-reset workers (scenario B): see docs/FRANKENPHP-WORKER-AUDIT.md.

Versioning

Semantic Versioning.

Quick start

Register Nowo\WordTemplateBundle\WordTemplateBundle if needed, then wire your templates and inject WordTemplateProcessorInterface:

Requirements

Development

Demos (FrankenPHP)

Demos run with FrankenPHP (Caddy + PHP in Docker). docker-compose defaults to APP_ENV=dev, so the entrypoint uses Caddyfile.dev (no PHP worker), and Twig/PHP changes are visible on refresh. Worker mode applies to a production-style setup — see docs/DEMO-FRANKENPHP.md.

From the repository root:

Or from demo/: make up (see demo/README.md).

The demo has four pages (the fourth, /loops, shows invoice-style row loops, loop variables, nested loops, maps and empty lists the same way): / fills a template discovered with listVariables() (scalars, HtmlContent, TableRows, nested conditionals, images); /conditionals shows one form field per PHP type, the ConditionalBlock decision each one produces and the expression conditionals of the same template, and downloads the merged .docx; /conditionals/examples shows each expression case as Word text, PHP context and result, with the template and the generated .docx to download. Playwright: make -C demo/symfony8 test-e2e, demo-screenshots, docx-previews.

Documentation

Additional documentation

Tests and coverage

Measured on 2026-10-29 with composer coverage-check (PHP 8.2 + PCOV, same command as the CI Tests & QA job):

Language Line coverage Gate Command
PHP 100% (lines of src/, Clover coverage/coverage.xml) 100% — composer coverage-check fails below it (CI, make release-check) make coverage-check
TS/JS N/A (no TypeScript/JavaScript code) — —
Python N/A (no Python code) — —

License

MIT License.


All versions of word-template-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2 <8.6
ext-dom Version *
ext-json Version *
ext-libxml Version *
ext-zip Version *
phpoffice/phpword Version ^1.4
psr/log Version ^1.1 || ^2.0 || ^3.0
symfony/cache Version ^7.4 || ^8.0
symfony/clock Version ^7.4 || ^8.0
symfony/config Version ^7.4 || ^8.0
symfony/dependency-injection Version ^7.4 || ^8.0
symfony/expression-language Version ^7.4 || ^8.0
symfony/http-kernel Version ^7.4 || ^8.0
symfony/yaml Version ^7.4 || ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nowo-tech/word-template-bundle contains the following files

Loading the files please wait ...