{"id":20313899,"url":"https://github.com/craftcms/rector","last_synced_at":"2025-04-11T17:16:49.260Z","repository":{"id":40327931,"uuid":"430147577","full_name":"craftcms/rector","owner":"craftcms","description":"Rector rules for updating plugins and modules to Craft CMS 4.","archived":false,"fork":false,"pushed_at":"2024-05-17T09:09:56.000Z","size":587,"stargazers_count":19,"open_issues_count":3,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-10-29T23:40:26.160Z","etag":null,"topics":["craftcms","rector"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/craftcms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-20T16:05:12.000Z","updated_at":"2024-05-17T09:10:00.000Z","dependencies_parsed_at":"2024-01-29T00:28:13.199Z","dependency_job_id":"2f327420-b9cf-4f25-b4f5-f26b65da6d93","html_url":"https://github.com/craftcms/rector","commit_stats":{"total_commits":97,"total_committers":3,"mean_commits":"32.333333333333336","dds":0.4742268041237113,"last_synced_commit":"3ddcfa2aba361249c4f815dfcb2b2f93819ff211"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftcms%2Frector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftcms%2Frector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftcms%2Frector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftcms%2Frector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craftcms","download_url":"https://codeload.github.com/craftcms/rector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248447600,"owners_count":21105140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["craftcms","rector"],"created_at":"2024-11-14T18:13:23.936Z","updated_at":"2025-04-11T17:16:49.240Z","avatar_url":"https://github.com/craftcms.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rector Rules for Craft CMS\n\nThis package provides [Rector](https://github.com/rectorphp/rector) rules for updating Craft CMS plugins and modules for:\n\n- [Craft CMS 3 → 4](#craft-cms-3--4)\n- [Craft CMS 4 → 5](#craft-cms-4--5)\n\n## Craft CMS 3 → 4\n\nFirst, ensure Craft 3.7.35 or later is Composer-installed. (Prior versions of Craft weren’t compatible with Rector.)\n\n```sh\ncomposer update craftcms/cms \n```\n\nThen run the following commands:\n\n```sh\ncomposer require php:^8.0.2 --ignore-platform-reqs\n```\n\n```sh\ncomposer config minimum-stability dev\n```\n\n```sh\ncomposer config prefer-stable true\n```\n\n```sh\ncomposer require craftcms/rector:dev-main --dev --ignore-platform-reqs\n```\n\n```sh\nvendor/bin/rector process src --config vendor/craftcms/rector/sets/craft-cms-40.php\n```\n\nIf you have code that extends Craft Commerce classes, you can run the following command as well:\n\n```sh\nvendor/bin/rector process src --config vendor/craftcms/rector/sets/craft-commerce-40.php\n```\n\nOnce Rector is complete, you’re ready to update `craftcms/cms`.\n\n```sh\ncomposer require craftcms/cms:^4.0.0-alpha -W --ignore-platform-reqs\n```\n\n## Craft CMS 4 → 5\n\nRun the following commands:\n\n```sh\ncomposer require php:^8.2 --ignore-platform-reqs\n```\n\n```sh\ncomposer config minimum-stability dev\n```\n\n```sh\ncomposer config prefer-stable true\n```\n\n```sh\ncomposer require craftcms/rector:dev-main --dev --ignore-platform-reqs\n```\n\n```sh\nvendor/bin/rector process src --config vendor/craftcms/rector/sets/craft-cms-50.php\n```\n\nOnce Rector is complete, you’re ready to update `craftcms/cms`:\n\n```sh\ncomposer require craftcms/cms:^5.0.0-beta.1 -W --ignore-platform-reqs\n```\n\n## Notes\n\n## Advanced Configuration\n\nIf you’d like to include additional Rector rules, or customize which files/directories should be processed,\nyou’ll need to give your project a `rector.php` file.\n\nHere’s an example which runs the Craft 4 rule set, but skips over a `src/integrations/` folder:\n\n```php\n\u003c?php\ndeclare(strict_types = 1);\n\nuse craft\\rector\\SetList as CraftSetList;\nuse Rector\\Core\\Configuration\\Option;\nuse Rector\\Config\\RectorConfig;\n\nreturn static function(RectorConfig $rectorConfig): void {\n    // Skip the integrations folder\n    $rectorConfig-\u003eskip([\n        __DIR__ . '/src/integrations',\n    ]);\n\n    // Import the Craft 4 upgrade rule set\n    $rectorConfig-\u003esets([\n        CraftSetList::CRAFT_CMS_40\n    ]);\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraftcms%2Frector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraftcms%2Frector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraftcms%2Frector/lists"}