Laravel Idea 4.4: @class directive, routes completion for JS, Translations and Livewire support improvements, and much more

Aug, 12, 2021

This release contains a lot of new features: it closes more than 20 public issues and about 10 internal tasks. We decided to start to make blog posts about each major update.

Laravel Idea will support only the last 3 major PhpStorm updates starting from this version, so Laravel Idea 4.4 will be available for 2020.3, 2021.1, and 2021.2 PhpStorm versions.

A new @class directive introduced in the Laravel 8.51 version is fully supported:

@class  directive

A popular tightenco/ziggy package helps to use Laravel routes inside Javascript code. Laravel Idea completes routes for these calls now:

JavaScript routes

Two new type providers will help PhpStorm to understand the type of $this variable in some cases. Some libraries, like Livewire, use $this variable in the Blade to connect the view and corresponding class(component). PhpStorm now will understand its type:

Livewire $this

Second place is lambdas inside ::macro() calls:

Macro $this

A lot of new Livewire completions were added. wire: HTML attributes and their values:

Livewire attributes

A new "smart GoTo" - redirecting PhpStorm to correct Eloquent scope and accessor/mutator methods:

Eloquent Smart GoTo

Another smart feature - completion for request array keys. Here it will collect email, name, and password fields, but remove password from the result set because of except call:

Request array fields

Translations support improvements - default language values showing in the right part of completion items and parameters completion:

Translation support improvements

Also, don't forget about the big feature which currently is under active development:

All phpDocs in code generations are now optional. Also, Laravel Idea will add return types there for projects with PHP >= 7.0. Everything is configurable in the settings:

Code generation settings

Laravel Idea managed to "fix" two annoying PhpStorm's warnings:
  • "Unused element" for classes and methods of console commands and Blade/Livewire components.
  • "Unhandled \Illuminate\Validation\ValidationException" (this one was solved with some kind of elegance. I'll try to write a blog post about it).

Small features:
  • Improved fetching for blade-ui-kit/blade-icons package icons sets.
  • "auth:sanctum" middleware completion if "laravel/sanctum" package is installed.
  • $request->isNotFilled() completions
  • to_route() function parameters completion
  • ->withoutMiddleware([]) method parameter completion
  • completion for $touches Eloquent field
  • assertDatabaseHas(Post::class, ['completion'])
  • $validator->sometimes() method validation rules completion

Thank you for keeping up with the last updates! We hope they will improve your productivity.
Laravel Idea team.