From composer
This tool can be installed with Composer.
Add the package as a dependency of your project
composer require --dev vincentlanglet/twig-cs-fixer
Then, use it!
vendor/bin/twig-cs-fixer lint /path/to/code
vendor/bin/twig-cs-fixer fix /path/to/code
Note
Although bin-dependencies may have composer conflicts, this is the recommended way because it will autoload everything you need.
As a PHAR
You can always fetch the stable version as a Phar archive through the following
link with the VERSION you're looking for:
wget -c https://github.com/VincentLanglet/Twig-CS-Fixer/releases/download/VERSION/twig-cs-fixer.phar
The PHAR files are signed with a public key which can be queried at
keys.openpgp.org with the id AC0E7FD8858D80003AA88FF8DEBB71EDE9601234.
Tip
You will certainly need to add
require_once __DIR__.'/vendor/autoload.php';in your config file in order to:
- Use existing node based rules.
- Write your own custom rules.