Updating For 2.0

Flarum 2.0 is a major release that includes a number of breaking changes and new features. This guide will help you update your extension to be compatible with Flarum 2.0 and take advantage of the new additions.
If you need help applying these changes or using new features, please start a discussion on the community forum.
Upgrade Automation
You can use the Flarum CLI to automate as much of the upgrade steps as possible:
Keep in mind the following information about the upgrade command:
- The process goes through multiple steps, each step points to the related documentation, and provides helpful tips.
- After each step, the changes are committed to Git so that you can always review the changes commit by commit.
- Mistakes can and will be made, after every step is finished you can view the changes made and make any necessary adjustments.
- Most of the steps should require little to no manual adjustments, except for the following:
- Adapt to accessing/extending lazy loaded Flarum modules. (Can require some amount of manual changes)
- Prepare for JSON:API changes. (100% manual changes requires)
- Search & Filter API changes. (Can require some amount of manual changes)
Cài đặt
The upgrader is just another command of the @flarum/cli npm package.
npm install -g @flarum/cli@3
v3 of the CLI is only compatible with v2.x of Flarum, if you wish to continue using the CLI for both v1.x and v2.x of Flarum, you can install them together. Read more about it here.
Sử dụng
Now to use, simply run the following command:
fl upgrade 2.0
Before you use the automated upgrade command, make sure to read the entire upgrade guide at least once to understand the changes.