Shift with red gradient lettering
Loading navigation...

Convert to multi-file components

The MFC Converter automates the conversion from legacy, class-based Livewire components to modern, multi-file components available in Livewire 4. Using the MFC Converter to automatically convert your components has an estimated time savings of 1 hour.

While legacy, class-based Livewire components are still compatible in Livewire 4, they are no longer the convention. Livewire 4 uses single-file components (SFC) or multi-file components (MFC).

Shift provides the MFC Converter to modernize your legacy, class-based Livewire components. If you wish to adopt SFC, you may run Livewire's livewire:convert command to convert from MFC to SFC.

Screenshot of a pull request with automated changes from the MFC Converter

Requirements

  • A Laravel application running Livewire 4 or higher.

Automated Conversions

The MFC Converter automates the following conversions:

  • Creating new multi-file component folder structures.
  • Migrating component class and view files.
  • Converting to anonymous class components.
  • Renaming class references to component names.
  • Detecting remaining class-based Livewire components.

Manual Conversions

The MFC Converter attempts to read your Livewire configuration to determine component paths and filenames. If you have a complex configuration or unconventional project structure, Shift may fallback to Livewire defaults. If so, you may move the converted components to your own custom location.