andersundsehr / grumphp-fractor-task
GrumPHP task for fractor
Package info
github.com/andersundsehr/grumphp-fractor-task
pkg:composer/andersundsehr/grumphp-fractor-task
Requires
- php: ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0
- phpro/grumphp: ^2.0.0
Requires (Dev)
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-06 10:40:56 UTC
README
andersundsehr/grumphp-fractor-task
A GrumPHP task for Fractor. Fractor does for non-PHP files what Rector does for PHP: it upgrades and refactors TypoScript, FlexForms, YAML and other files in TYPO3 projects.
The task runs Fractor in dry-run mode and fails if Fractor would change a file.
This task is part of
pluswerk/grumphp-config. If you use that package, the task, Fractor and afractor.phpare already installed and configured.
Requirements
- PHP 8.2 or newer
- GrumPHP 2
- Fractor, e.g.
a9f/typo3-fractor
Installation
composer require --dev andersundsehr/grumphp-fractor-task a9f/typo3-fractor
Register the extension and the task in your grumphp.yml:
grumphp: tasks: fractor: config: null triggered_by: ['php'] ignore_patterns: [] clear_cache: true no_diffs: false extensions: - Andersundsehr\GrumPHPFractorTask\ExtensionLoader
Fractor needs a configuration file, by default fractor.php in the project root. A minimal example:
<?php declare(strict_types=1); use a9f\Fractor\Configuration\FractorConfiguration; use a9f\Typo3Fractor\Set\Typo3LevelSetList; return FractorConfiguration::configure() ->withPaths([__DIR__ . '/packages/']) ->withSets([Typo3LevelSetList::UP_TO_TYPO3_13]);
Options
config
Default: null
Path to the Fractor configuration file. With null, Fractor uses fractor.php in the project root.
triggered_by
Default: ['php']
File extensions that start the task. In the pre-commit hook only matching staged files are passed to Fractor. Fractor itself mostly works on other file types, so add the extensions your project uses, for example typoscript, tsconfig, xml or yaml, if commits that only touch those files should be checked as well.
ignore_patterns
Default: []
Paths that the task does not pass to Fractor: plain strings that a path must contain, or regular expressions delimited with /. Use this to skip files such as test fixtures.
clear_cache
Default: true
Run Fractor without its cache (--clear-cache). Set it to false for faster runs.
no_diffs
Default: false
Do not show the diffs of the changes Fractor would make (--no-diffs).
How it works
The task runs
fractor process --dry-run --ansi --no-progress-bar [--config=…] [--clear-cache] [--no-diffs] [files…]
- In the
pre-commithook it passes the staged files that matchtriggered_byand are not excluded byignore_patterns. - With
vendor/bin/grumphp runit passes no files, so Fractor checks the paths from its configuration. - If Fractor would change something, the task fails. GrumPHP then offers to run the same command without
--dry-run, which applies the changes.
Contributing
This package is developed in the monorepo andersundsehr/grumphp-config. Please open issues and pull requests there.
License
with ♥️ from anders und sehr GmbH
If something did not work 😮
or you appreciate this Extension 🥰 let us know.
We are hiring https://www.andersundsehr.com/karriere/