A PHP Command Line tool for compiling Twig template files.
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/itsahappymedium/ttc
Requires
- php: ^7.3|^8.0
- splitbrain/php-cli: ^1.1
- symfony/yaml: ^6.0
- twig/twig: ^3.4.3
This package is auto-updated.
Last update: 2025-10-13 22:02:11 UTC
README
A PHP Command Line tool for compiling Twig template files.
Installation
To a package (local)
composer require-dev itsahappymedium/ttc
./vendor/bin/ttc help
To your system (global)
composer global require itsahappymedium/ttc
ttc help
Usage
Example
# Compiles all .twig files in the `templates` directory recursively # Using variables from the `staging-server` object in `config.yml` # Placing all generated files in the `public` directory ttc -r -s templates -d public -f config.yml -b staging-server
At the very least, one of input or source options are required.
Options
-
--arguments-file/-f- A file to load twig arguments/variables from. -
--arguments-file-type/-t- The type of filearguments-fileis. (Possible values:env,json,yml) (If omitted, the file type will be automatically determined based on the file extension.) -
--arguments-file-base/-b- A dot-notation path inside ofarguments-filewhere the arguments/variables should be loaded from. -
--destination/-d- The directory to place the generated files in. (If omitted, the files will be placed in the same directory as the twig files) -
--input/-i- An individual twig file to compile. -
--output/-o- The path where the individual compiled file should go. (Used in combination withinput) (If omitted, the compiled file will be placed in the same directory as the twig file) -
--source/-s- The directory where the twig files are.
Flags
--recursive/-r- Sets whether or not thesourcedirectory should be searched recursively. (Only used when thesourceoption is used)
Related
-
FEC - A PHP Command Line tool that makes it easy to compile, concat, and minify front-end Javascript and CSS/SCSS dependencies.
-
GPM - A PHP Command Line tool that makes it easy to download dependencies from GitHub.
License
MIT. See the license.md file for more info.