PHPackages                             leek/rector-filament - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. leek/rector-filament

ActiveRector-extension[Testing &amp; Quality](/categories/testing)

leek/rector-filament
====================

Rector rules for Filament v4 upgrades and code quality.

6903↓35.7%1PHP

Since Feb 5Pushed 2mo agoCompare

[ Source](https://github.com/leek/rector-filament)[ Packagist](https://packagist.org/packages/leek/rector-filament)[ RSS](/packages/leek-rector-filament/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (1)

 [![](https://private-user-images.githubusercontent.com/60204/545650782-b92808b1-bef3-4340-84ac-229c3e681ad7.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzIxMzgxNzQsIm5iZiI6MTc3MjEzNzg3NCwicGF0aCI6Ii82MDIwNC81NDU2NTA3ODItYjkyODA4YjEtYmVmMy00MzQwLTg0YWMtMjI5YzNlNjgxYWQ3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAyMjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMjI2VDIwMzExNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNlZTYwOGVkMjdhNzBjMmUxNWI3MTJjNTk3MDY4ZmM3Mjc4MWFjYTYxMmVlZDY2MWRkODY3ZTllNmJlOWY2MTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.5HwadXXAYcf8fPl8mXmsr-U9IvQxVkuDZY8Qd-UF9S8)](https://private-user-images.githubusercontent.com/60204/545650782-b92808b1-bef3-4340-84ac-229c3e681ad7.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzIxMzgxNzQsIm5iZiI6MTc3MjEzNzg3NCwicGF0aCI6Ii82MDIwNC81NDU2NTA3ODItYjkyODA4YjEtYmVmMy00MzQwLTg0YWMtMjI5YzNlNjgxYWQ3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAyMjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMjI2VDIwMzExNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNlZTYwOGVkMjdhNzBjMmUxNWI3MTJjNTk3MDY4ZmM3Mjc4MWFjYTYxMmVlZDY2MWRkODY3ZTllNmJlOWY2MTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.5HwadXXAYcf8fPl8mXmsr-U9IvQxVkuDZY8Qd-UF9S8)

Rector Rules for Filament
=========================

[](#rector-rules-for-filament)

[Rector](https://github.com/rectorphp/rector) rules for [Filament](https://filamentphp.com/) v4 upgrades and code quality.

Install
-------

[](#install)

```
composer require --dev leek/rector-filament
```

Usage
-----

[](#usage)

### Option A: Set Provider (auto-detect Filament version)

[](#option-a-set-provider-auto-detect-filament-version)

```
use RectorFilament\Set\FilamentSetProvider;

return RectorConfig::configure()
    ->withSetProviders(FilamentSetProvider::class)
    ->withComposerBased();
```

### Option B: Explicit sets

[](#option-b-explicit-sets)

```
use RectorFilament\Set\FilamentSetList;

return RectorConfig::configure()
    ->withSets([
        FilamentSetList::FILAMENT_40,
        FilamentSetList::FILAMENT_CODE_QUALITY,
    ]);
```

Available Sets
--------------

[](#available-sets)

SetConstantDescriptionFilament v4`FilamentSetList::FILAMENT_40`Rules for upgrading to Filament v4Code Quality`FilamentSetList::FILAMENT_CODE_QUALITY`Convention and bug-prevention rulesRules
-----

[](#rules)

### Filament v4 (`FILAMENT_40`)

[](#filament-v4-filament_40)

#### Namespace Changes

[](#namespace-changes)

##### ActionsNamespaceRector

[](#actionsnamespacerector)

Updates action imports from `Tables`, `Notifications`, and `Forms` namespaces to `Filament\Actions\*`.

```
-use Filament\Tables\Actions\EditAction;
-use Filament\Notifications\Actions\Action;
-use Filament\Forms\Actions\Action;
+use Filament\Actions\EditAction;
+use Filament\Actions\Action;
+use Filament\Actions\Action;
```

##### GetSetNamespaceRector

[](#getsetnamespacerector)

Updates `Get` and `Set` utility imports from `Filament\Forms\*` to `Filament\Schemas\Components\Utilities\*`.

```
-use Filament\Forms\Get;
-use Filament\Forms\Set;
+use Filament\Schemas\Components\Utilities\Get;
+use Filament\Schemas\Components\Utilities\Set;
```

##### SchemaComponentsNamespaceRector

[](#schemacomponentsnamespacerector)

Updates layout component imports from `Filament\Forms\Components\*` to `Filament\Schemas\Components\*`.

```
-use Filament\Forms\Components\Fieldset;
-use Filament\Forms\Components\Grid;
-use Filament\Forms\Components\Section;
-use Filament\Forms\Components\Split;
-use Filament\Forms\Components\Tabs;
-use Filament\Forms\Components\Wizard;
+use Filament\Schemas\Components\Fieldset;
+use Filament\Schemas\Components\Grid;
+use Filament\Schemas\Components\Section;
+use Filament\Schemas\Components\Split;
+use Filament\Schemas\Components\Tabs;
+use Filament\Schemas\Components\Wizard;
```

#### Method Renames

[](#method-renames)

##### ActionFormToSchemaRector

[](#actionformtoschemarector)

Renames `->form()` to `->schema()` on Action, BulkAction, and Filter classes.

```
 Action::make('export')
-    ->form([
+    ->schema([
         TextInput::make('name'),
     ])
     ->action(fn () => null);
```

##### TableActionsToRecordActionsRector

[](#tableactionstorecordactionsrector)

Renames `->actions()` to `->recordActions()` on Table.

```
 $table
-    ->actions([
+    ->recordActions([
         EditAction::make(),
     ]);
```

##### BulkActionsToToolbarActionsRector

[](#bulkactionstotoolbaractionsrector)

Transforms `->bulkActions([...])` to `->toolbarActions([BulkActionGroup::make([...])])` on Table.

```
 $table
-    ->bulkActions([
-        DeleteBulkAction::make(),
-    ]);
+    ->toolbarActions([
+        BulkActionGroup::make([
+            DeleteBulkAction::make(),
+        ]),
+    ]);
```

##### FiltersLayoutArgToMethodRector

[](#filterslayoutargtomethodrector)

Extracts the second argument of `->filters()` into a chained `->filtersLayout()` call.

```
 $table
-    ->filters([
-        Filter::make('active'),
-    ], layout: FiltersLayout::AboveContent);
+    ->filters([
+        Filter::make('active'),
+    ])
+    ->filtersLayout(FiltersLayout::AboveContent);
```

##### ReactiveToLiveRector

[](#reactivetoliverector)

Renames `->reactive()` to `->live()` on Filament components.

```
 TextInput::make('name')
-    ->reactive();
+    ->live();
```

##### MutateFormDataUsingToMutateDataUsingRector

[](#mutateformdatausingtomutatedatausingrector)

Renames `->mutateFormDataUsing()` to `->mutateDataUsing()` on Actions.

```
 Action::make('create')
-    ->mutateFormDataUsing(fn (array $data) => $data);
+    ->mutateDataUsing(fn (array $data) => $data);
```

##### ImageColumnSizeToImageSizeRector

[](#imagecolumnsizetoimagesizerector)

Renames `->size()` to `->imageSize()` on `ImageColumn`.

```
 ImageColumn::make('avatar')
-    ->size(50);
+    ->imageSize(50);
```

##### PlaceholderToTextEntryRector

[](#placeholdertotextentryrector)

Replaces `Placeholder::make()->content()` with `TextEntry::make()->state()` and updates the use import.

```
-use Filament\Forms\Components\Placeholder;
+use Filament\Infolists\Components\TextEntry;

-Placeholder::make('name')->content('value');
+TextEntry::make('name')->state('value');
```

##### EmptyLabelToHiddenLabelRector

[](#emptylabeltohiddenlabelrector)

Replaces `->label('')` with `->hiddenLabel()` on components, or `->iconButton()` on Actions. Table Columns are skipped.

```
 TextInput::make('name')
-    ->label('');
+    ->hiddenLabel();

 Action::make('delete')
-    ->label('');
+    ->iconButton();
```

#### Closure Parameter Renames

[](#closure-parameter-renames)

##### ModelToRecordClosureParamRector

[](#modeltorecordclosureparamrector)

Renames `$model` to `$record` in Filament closure parameters.

```
 Action::make('view')
-    ->visible(function ($model) {
-        return $model->is_active;
+    ->visible(function ($record) {
+        return $record->is_active;
     });
```

##### LivewireComponentParamNameRector

[](#livewirecomponentparamnamerector)

Renames `Livewire\Component` type-hinted parameters to `$livewire` in Filament closures.

```
 TextInput::make('name')
-    ->visible(function (Component $component) {
-        return $component->getData();
+    ->visible(function (Component $livewire) {
+        return $livewire->getData();
     });
```

### Code Quality (`FILAMENT_CODE_QUALITY`)

[](#code-quality-filament_code_quality)

#### NullableAfterStateUpdatedStateRector

[](#nullableafterstateupdatedstaterector)

Makes `$state` parameter nullable in `afterStateUpdated` callbacks to prevent type errors when fields are cleared.

```
 TextInput::make('name')
-    ->afterStateUpdated(function (string $state) {
+    ->afterStateUpdated(function (?string $state) {
         // ...
     });
```

#### ModifyQueryUsingBuilderToQueryRector

[](#modifyqueryusingbuildertoqueryrector)

Renames `$builder` to `$query` in `modifyQueryUsing` callbacks to follow Filament convention.

```
-->modifyQueryUsing(fn (Builder $builder) => $builder->where('active', true))
+->modifyQueryUsing(fn (Builder $query) => $query->where('active', true))
```

#### FilamentUtilityInjectionTypeRector

[](#filamentutilityinjectiontyperector)

Adds proper type hints for Filament utility injection parameters (`$get`, `$set`, `$record`, `$operation`, `$component`, `$livewire`) in closures.

```
 TextInput::make('name')
-    ->visible(function ($get, $record) {
+    ->visible(function (Get $get, ?Model $record) {
         return $get('type') === 'business';
     });
```

License
-------

[](#license)

MIT

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance56

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e11ad2f75cb1d558136f1982458d541d96fb84a217d6a82e8c18df2ff503964b?d=identicon)[leek](/maintainers/leek)

---

Top Contributors

[![leek](https://avatars.githubusercontent.com/u/60204?v=4)](https://github.com/leek "leek (26 commits)")

### Embed Badge

![Health badge](/badges/leek-rector-filament/health.svg)

```
[![Health](https://phpackages.com/badges/leek-rector-filament/health.svg)](https://phpackages.com/packages/leek-rector-filament)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
