Saltar al contenido principal
Version: 1.x

Updating For 1.x

tip

If you need help applying these changes or using new features, please start a discussion on the community forum or Discord chat.

1.7

Frontend

Backend

  • Support for php 8.2, deprecations are still thrown by some packages, the testing workflow has been updated to ignore deprecations on 8.2
  • The /api endpoint now contains the actor as an included relationship.
  • The Model::dateAttribute($attribute) extender is deprecated, use Model::cast($attribute, 'datetime') instead.

Tooling

1.6 Changes

Backend

  • Added customizable session drivers through the Session extender.

1.5 Changes

Frontend

  • More portions of the frontend are now written in TypeScript, providing a better extension development experience.
  • Modals can be used in stacks, allowing for multiple modals to be open at once. This is useful for modals that open other modals: app.modal.show(ModalComponent, { attrs }, true).

Backend

  • There is a new createTableIfNotExists migration helper, which can be used to create tables only if they don't already exist.

1.4 Changes

No developer-facing changes were made in Flarum v1.4.

1.3 Changes

Flarum v1.3 included mostly QoL improvements. Below are listed note worthy changes for extension developers:

Frontend

  • More portions of the frontend are now written in TypeScript, providing a better extension development experience.
  • Frontend errors will no longer cause the forum to crash into a NoJs page. The extension will fail to execute its frontend code (initializer) and display an error to the admin through an alert, and to all users through the console. The frontend will continue to execute without the extension's frontend changes.
  • The markdown toolbar can now be used on the admin side.

Backend

  • Calculation of the number attribute on posts has changed and no longer relies on the discussion model's post_number_index attribute which is now deprecated and will be removed in 2.0
  • Extension event listeners are now added after core even listeners, this should generally cause no changes in behavior.

Tooling

  • The backend tests workflow now automatically fails tests if there are any PHP warnings and notices.

1.2 Changes

Flarum v1.2 included quite a few bugfixes, internal refactors, and new features. The following recaps the most important changes for extension developers:

Frontend

  • Flarum core now passes TypeScript type checking (on the portion written in TypeScript). Additionally, major portions of the frontend (models, the application instance, and others) are now written in TypeScript. These changes should make it much easier and more fruitful to write extensions in TypeScript.
  • Instead of directly using Less variables in CSS code, core now uses CSS variables. For the most part, we've just created CSS variables and set their values to the Less variables. This should make theming and customizing CSS a lot easier. https://github.com/flarum/core/pull/3146.
  • Dropdowns can now be lazy-drawn to improve performance. You can do this by setting the lazy draw attr to "true". https://github.com/flarum/core/pull/2925.
  • Textarea-type settings are now supported through the app.extensionData.registerSetting util.
  • You can now use Webpack 5 to bundle your extension's code. This will offer minor bundle size improvements.
  • A new flarum/common/components/ColorPreviewInput component has been added. It can be used directly, or through the color-preview type when registered via app.extensionData.registerSetting.
  • Extensions can now modify the minimum search length of the Search component.
  • The following components are now extensible:
  • Extensions now have finer control over positioning when adding elements to the DiscussionPage sidebar items: https://github.com/flarum/core/pull/3165

Backend

Misc

Tooling

  • The flarum-cli infra command can now be used to update or enable various infrastructure features. You can now add the following to your extension in just one command:
    • TypeScript
    • Prettier for JS/TS formatting
    • Backend testing with PHPUnit
    • Code formatting with StyleCI
    • EditorConfig support
    • GitHub actions for automating testing, linting, type checking, and building.
  • You can also exclude any files from these updates by adding their relative path to the "extra.flarum-cli" key's array in your extension's composer.json file. For example, if you wanted to exclude your tsconfig file from any updates by the infra system, the "extra.flarum-cli" key's value should be ["js/tsconfig.json"].
  • The flarum-cli audit infra can be used to check that all infra modules your extension uses are up to date. The --fix flag can be used to automatically fix any issues, which has essentially the same effect as running flarum-cli infra for each outdated module.
  • All flarum-cli commands can now be run with a --no-interaction flag to prevent prompts. Defaults will be used when possible, and errors will be thrown if a prompt is needed and there is no default.
  • Frontend GH actions now support type-checking, as well as type coverage reports.

1.1 Changes

Flarum version 1.1 mostly focuses on bugfixes and quality-of-life improvements following our stable release earlier this year. These are mainly user-facing and internal infrastructure changes, so extensions are not significantly affected.

Frontend

Backend

  • Flarum now comes with a Preload extender for preloading any custom frontend assets.
  • A new Theme extender now allows overriding Less files and internal imports. This allows themes to more easily completely replace Less modules.