Tutorials

Laravel Best Practices: How to Automate Your Routine

Read this post in other languages:

You’re a Laravel developer, a web artisan. You want to be more productive, right? In this blog post, you’ll learn how to increase your productivity using PhpStorm with the Laravel Idea plugin.

Smart autocompletion

One crucial feature that boosts the productivity of Laravel developers is autocompletion for the actions they use on a daily basis. With a deep understanding of your Laravel codebase, PhpStorm bundled with the Laravel Idea plugin supports autocompletion of the most frequently used commands. Let’s take a look at each of them.

Eloquent

Laravel does quite a lot to make Eloquent such a powerful ORM, and PhpStorm is able to understand everything thanks to the Laravel Idea plugin. The benefits range from autocompletion on methods like scopes, to PhpStorm knowing about all available model fields and relations, to full query builder and factory support, and much more.

Eloquent support for Laravel in PhpStorm

Route support

The bundle provides autocompletion and insights into routes everywhere. You’ll get autocompletion on route names and route methods. 

Route support for Laravel in PhpStorm

Livewire

Livewire, the library that drastically simplifies dynamic interfaces, is also supported. You’ll get autocompletion on methods and properties, you can easily switch between view and component files, you can click on components, and much more.

Livewire support for Laravel in PhpStorm

Request classes

PhpStorm combined with the Laravel Idea plugin supports request classes and validation rules, adding a bunch of autocompletions and insights wherever you need them. You can also generate default request rules based on models.

Support for request classes and validation rules for Laravel in PhpStorm

Code generation

Laravel Idea has support for generating almost anything. From controllers and middleware to migrations and console commands, it’s all there. You don’t have to remember “make” commands and their parameters. Laravel Idea provides a clean interface to generate everything you need.

Code generation for Laravel in PhpStorm

Syntax Highlighting in Blade

PhpStorm already offers powerful syntax highlighting for different constructs and syntax errors right out of the box. For Laravel artisans, we added Blade support via Laravel’s template engine. 

You can extract code to blade components, and there’s autocompletion for those components. In addition, you can refactor a Blade file name and automatically update all its references. You can even create Blade files from within controllers, have autocompletion within those blade files, and much more.

Syntax highlighting in Blade for Laravel in PhpStorm

Automated adjusting of namespaces and imports

Apart from autocompletion and highlighting, PhpStorm has a range of powerful features related to automatically adjusting namespaces and imports.

When you move a file, PhpStorm adjusts its namespace and all imports automatically. When referencing any class, PhpStorm will add imports for it. PhpStorm does a lot of boring work for you with its refactoring capabilities, such as renaming variables or extracting code into separate methods, as well as offering error detection, code generation, formatting assistance, and more.

Automated Namespace and Imports Adjusting for Laravel in PhpStorm

Frontend framework support

PhpStorm also has built-in support for popular frontend frameworks like Tailwind, Vue, React, and many others.

Support of frontend framework in PhpStorm

Application integration

Here are some of the tools that are built into PhpStorm out of the box: our GIT integration (including GitHub support), our HTTP client, a debugger, and database tools, just to name a few.

Application integration in PhpStorm

New Laravel course by Jeffrey Way

Want to take a closer look at what the PhpStorm and Laravel Idea bundle has to offer? Take this free online course on Laracasts and learn how to:

  • Enhance your Laravel development by coding in PhpStorm with the Laravel Idea plugin.
  • Refactor, debug, and test your code using PestPHP.
  • Write better code and be more productive with Laravel. 

And that’s not all! Now you can enjoy the Laravel Idea plugin with a special 50% discount. Claim the offer here.

Get the bundle at 50% OFF

image description