Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Typo3 Rector Laravel Package

ssch/typo3-rector

Automated upgrades and refactoring for TYPO3 sites and extensions using Rector. Apply version migrations, remove deprecations, and modernize code safely in development with configurable rule sets for TYPO3 7–12+.

View on GitHub
Deep Wiki
Context7

Table of Contents

  1. Examples in action
  2. Overview of all rules
  3. Installation
  4. Configuration and Processing
  5. Best practice guide
  6. Limitations
  7. Contribution

Configuration and Processing

This library ships already with a bunch of configuration files organized by TYPO3 version. To get started quickly, run the following command inside the root directory of your project:

vendor/bin/typo3-init

The command generates a basic configuration skeleton which you can adapt to your needs.

Also have a look at the class Typo3SetList. There you can find all the available TYPO3 sets you can configure in the configuration file.

For more configuration options, see Rector README.

After you adopt the configuration to your needs, run vendor/bin/rector --dry-run to simulate (hence the option --dry-run) the future code fixes:

vendor/bin/rector process --dry-run

Check if everything makes sense and run the process command without the --dry-run option to apply the changes.

If you see some code change that you want to exclude, you can either exclude a single file to be skipped or you can also exclude a single rule which you don't want to be applied.

Both can be done via the skip configuration option like so:

return RectorConfig::configure()
    ->withSets([
        Typo3LevelSetList::UP_TO_TYPO3_12,
    ])
    ->withPaths([
        __DIR__ . '/packages',
    ])
    ->withSkip([
        RuleToBeSkippedRector::class,
        __DIR__ . '/packages/my_extension/Classes/FileToBeSkipped.php',
    ]);

Use with the --config option

If the Rector configuration is not in the main directory (e.g. /var/www/html/), the CLI option --config must be added. If the CLI option --config is used, the paths in the Rector configuration file must be adapted, as this is based on the path of the rector.php file in the standard configuration.

Instead of __DIR__ the PHP method getcwd() must be used. This takes the starting point for the execution of Rector.

Example with the option --config and custom rector.php location

The file rector.php is located in the directory /var/www/Build/rector/ and it is executed via cd /var/www/html/ && ./vendor/bin/rector process --config ../Build/rector/rector.php. The starting point with the PHP method getcwd() is then /var/www/html/ instead of /var/www/html/Build/rector/ with __DIR__.

$rectorConfig->skip([
    NameImportingPostRector::class => [
        'ClassAliasMap.php',
        'ext_localconf.php',
        'ext_emconf.php',
        'ext_tables.php',
        getcwd() . '/**/Configuration/TCA/*',
        getcwd() . '/**/Configuration/RequestMiddlewares.php',
        getcwd() . '/**/Configuration/Commands.php',
        getcwd() . '/**/Configuration/AjaxRoutes.php',
        getcwd() . '/**/Configuration/Extbase/Persistence/Classes.php'
    ]
])

Example with the option --config and predefined paths in a custom rector.php location

In order to process the source files of only one TYPO3 extension, it's recommended to define said extension's path via the Option::PATHS parameter within the config file:

// paths to refactor; solid alternative to CLI arguments
$rectorConfig->paths([
    getcwd() . '/**/acme_demo/'
]);
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport