Skip to content

Commit bf2aa8c

Browse files
authored
Merge pull request #222 from andreaswolf/improve-readme
[DOCS] Improve README
2 parents e7fa049 + 4132286 commit bf2aa8c

File tree

1 file changed

+35
-19
lines changed

1 file changed

+35
-19
lines changed

README.md

+35-19
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Fractor is a generic tool for changing all kinds of files via defined rules—si
1010

1111
The main package `a9f/fractor` provides infrastructure for configuring, running and extending Fractor,
1212
but no rules for changing any files.
13-
These are provided by individual packages specific for different file types (like `a9f/fractor-xml`)
14-
or ecosystems (like `a9f/typo3-fractor`).
13+
These are provided by individual packages specific for different file types
14+
(like `a9f/fractor-composer-json`, `a9f/fractor-xml` or `a9f/fractor-yaml`) or ecosystems (like `a9f/typo3-fractor`).
1515

1616
For different file types, different operation modes are possible.
1717
For XML, there is a full-blown tree traversal implemented in `a9f/fractor-xml`,
@@ -28,15 +28,29 @@ there is no advanced support available right now.
2828
* Available rules for composer.json files are documented in [the fractor-composer-json package](./packages/fractor-composer-json/docs/composer-json-fractor-rules.md)
2929
* Available rules for TYPO3 are documented in [the typo3-fractor package](./packages/typo3-fractor/docs/typo3-fractor-rules.md)
3030

31+
## Requirements
32+
33+
Fractor needs at least PHP 8.2.
34+
If you want to migrate outdated systems, that don't support PHP 8.2, you can install Fractor, for example, in a Docker
35+
container that is based on a PHP 8.2 image and then run it from there.
36+
Alternatively, you can run Fractor within a CI Pipeline that is using PHP 8.2 and then commit the code changes within CI.
3137

3238
## Installation
3339

34-
Install Fractor via composer by running the following command in your terminal:
40+
If you want to migrate common files, you can specify the file types you want to support.
41+
Fractor core will be installed automatically and doesn't need to be required directly.
42+
43+
Install Fractor with the file types you need via composer by running the following command in your terminal:
3544

3645
```bash
37-
# you can use any combination of packages here;
38-
# as TYPO3 users, you probably want a9f/typo3-fractor foremost.
39-
composer require a9f/fractor a9f/fractor-xml --dev
46+
composer require a9f/fractor-composer-json a9f/fractor-xml a9f/fractor-yaml --dev
47+
```
48+
49+
As **TYPO3** users, you probably want to use `a9f/typo3-fractor` only which will install all necessary file types for
50+
you like fluid, typoscript, xml and yaml:
51+
52+
```bash
53+
composer require a9f/typo3-fractor --dev
4054
```
4155

4256
## Configuration
@@ -113,10 +127,10 @@ return FractorConfiguration::configure()
113127
->withOptions([
114128
XmlProcessorOption::INDENT_CHARACTER => Indent::STYLE_TAB,
115129
XmlProcessorOption::INDENT_SIZE => 1,
116-
])
130+
]);
117131
```
118132

119-
If you want to adjust the format of your typoscript files, you can configure it this way:
133+
If you want to adjust the format of your TypoScript files, you can configure it this way:
120134

121135
```php
122136
<?php
@@ -133,27 +147,30 @@ return FractorConfiguration::configure()
133147
TypoScriptProcessorOption::ADD_CLOSING_GLOBAL => false,
134148
TypoScriptProcessorOption::INCLUDE_EMPTY_LINE_BREAKS => true,
135149
TypoScriptProcessorOption::INDENT_CONDITIONS => true,
136-
])
150+
]);
137151
```
138152

139153
## Processing
140154

141-
Execute Fractor from the command line, passing the path to your configuration file as an argument:
155+
Before executing the code migrations, run the following command to see a preview of what Fractor will do:
142156

143157
```bash
144-
vendor/bin/fractor process -f fractor.php
158+
vendor/bin/fractor process --dry-run
145159
```
146160

147-
Fractor will apply the rules specified in the configuration file to the targeted files.
161+
Fractor will output all the potential changes on the console without real execution.
162+
148163
Review the changes made by Fractor to ensure they meet your expectations.
164+
If you see some things that Fractor should not migrate for some reason, adjust your config file and exclude either rules,
165+
some paths or single files.
149166

150-
You would also run fractor in dry mode:
167+
When you feel confident, execute the code migrations with the following command:
151168

152169
```bash
153-
vendor/bin/fractor process -f fractor.php --dry-run
170+
vendor/bin/fractor process
154171
```
155172

156-
Fractor will output all the potential changes on the console without real execution.
173+
Fractor will now apply the rules specified in the configuration file to the targeted files.
157174

158175
## Customization
159176

@@ -181,8 +198,6 @@ Here's how you can extend Fractor with a custom rule:
181198

182199
### Supporting New File Types
183200

184-
#### Supporting New File Types
185-
186201
- To support a new file type, you will need to implement an instance of `\a9f\Fractor\Fractor\FileProcessor`.
187202
This processor must take care of decoding a file and then traversing the decoded file structure
188203
(e.g., the DOM tree of an XML file; see `\a9f\FractorXml\XmlFileProcessor` for an example)
@@ -196,7 +211,8 @@ Here's how you can extend Fractor with a custom rule:
196211

197212
- Document your custom rules and file type extensions to aid other users in understanding and utilizing your contributions.
198213

199-
By extending Fractor in this manner, you can enhance its capabilities and adapt it to handle a wider range of file formats and transformation scenarios.
214+
By extending Fractor in this manner, you can enhance its capabilities and adapt it to handle a wider range of file formats
215+
and transformation scenarios.
200216

201217
## Contributing
202218

@@ -210,7 +226,7 @@ we welcome contributions from the community. Here's how you can contribute:
210226

211227
## Support
212228

213-
For any questions or support regarding Fractor, please open an issue on GitHub. We'll do our best to assist you promptly.
229+
For any questions or support regarding Fractor, please open an issue on GitHub. We'll do our best to help you promptly.
214230

215231
## License
216232

0 commit comments

Comments
 (0)