Laravel のベストプラクティス: ルーチンの自動化
Laravel 開発者であり、ウェブ職人であるあなたなら、 生産性を高めたいと思うことはありませんか? このブログ記事では、PhpStorm と Laravel Idea プラグインを併用して生産性を高める方法について学びます。スマート自動補完
Laravel 開発者の生産性を向上させる上できわめて重要な機能の中には、日常的に使用するアクションの自動補完があります。 PhpStorm は Laravel のコードベースを深く理解しており、Laravel Idea プラグインのバンドルを通じて最も頻繁に使用されるコマンドの自動補完をサポートしています。 それぞれ詳しく見ていきましょう。Eloquent
Laravel は多大な処理を通じて Eloquent を非常に強力な ORM にしており、PhpStorm は Laravel Idea プラグインを利用してそのすべてを理解することができます。 scope のようなメソッドの自動補完から PhpStorm による使用可能なすべてのモデルフィールドとリレーションの認識、さらにはクエリ全文のビルダーやファクトリのサポートなどに至るまで、幅広いメリットがあります。
ルートのサポート
このバンドルは、あらゆる場所でルートの自動補完とインサイトを提供します。 ルート名やルートのメソッドで自動補完を使用できます。
Livewire
動的インターフェースを大幅に単純化する Livewire ライブラリもサポートされています。 メソッドとプロパティでの自動補完、ビューファイルとコンポーネントファイルの簡単な切り替え、コンポーネントのクリック操作などが可能です。
Request クラス
PhpStorm と Laravel Idea プラグインを併用すると Request クラスと検証ルールがサポートされ、多数の自動補完とインサイトを必要な箇所で使用できます。 また、モデルに基づいてデフォルトのリクエストルールを生成することもできます。
コード生成
Laravel Idea では、ほぼすべてのものを生成できます。 コントローラーやミドルウェアから、移行やコンソールコマンドに至るまで、すべてが揃っています。 “make” コマンドやそのパラメーターを覚えておく必要はありません。 Laravel Idea には必要なものをすべて生成できるすっきりとしたインターフェースが備わっています。
Blade の構文ハイライト
PhpStorm はさまざまなコンストラクトや構文エラーに対応した強力な構文ハイライトを初期状態で提供します。 Laravel 職人向けに Laravel のテンプレートエンジンを介して Blade をサポートするようにしました。 Blade コンポーネントにコードを抽出可能であるだけでなく、そのようなコンポーネント用の自動補完も用意されています。 また、Blade ファイル名をリファクタリングし、自動的にそのすべての参照を更新することができます。 コントローラー内から Blade ファイルを作成することも、その Blade ファイル内で自動補完を使用することも可能です。
名前空間とインポートの自動調整
PhpStorm には自動補完やハイライトだけでなく、名前空間とインポートの自動調整に関連する強力な機能も幅広く備わっています。 ファイルを移動させると、PhpStorm が名前空間とすべてのインポートを自動的に調整します。 クラスを参照する際には、PhpStorm がそのインポートを追加してくれます。 PhpStorm のリファクタリング機能が変数の名前変更や複数の独立したメソッドへのコードの抽出などの退屈な作業を肩代わりします。また、エラー検出、コード生成、整形支援なども提供します。
フロントエンドフレームワークのサポート
PhpStorm には、Tailwind、Vue、React などの一般的なフロントエンドフレームワークのサポートも組み込まれています。

アプリケーションの統合
PhpStorm に初期状態で組み込まれているツールには GIT 統合(GitHub サポートを含む)、HTTP クライアント、デバッガー、データベースツールなどがありますが、これらはほんの一部に過ぎません。
Jeffrey Way による新しい Laravel コース
PhpStorm と Laravel Idea バンドルの機能についてさらに詳しく知りたいですか? こちらの無料の Laracasts オンラインコースでは以下の内容を学習できます。-
- PhpStorm と Laravel Idea プラグインを使ってコーディングし、Laravel 開発を強化する。
-
- PestPHP を使ってコードのリファクタリング、デバッグ、およびテストを実行する。
-
- Laravel でより優れたコードを記述し、生産性を高める。
Subscribe to PhpStorm Blog updates
Discover more
Laravel 모범 사례: 루틴을 자동화하는 방법
여러분은 Laravel 개발자이자 웹 장인으로서, 생산성을 높이고 싶으실 겁니다. 그렇죠? 이 블로그 게시물에서는 Laravel Idea 플러그인과 함께 PhpStorm을 사용하여 생산성을 높이는 방법을 알아봅니다.
스마트 자동 완성
Laravel 개발자의 생산성을 높이는 중요한 기능 중 하나는 매일 사용하는 액션에 대한 자동 완성 기능입니다. Laravel Idea 플러그인이 번들로 제공되는 PhpStorm은 Laravel 코드 베이스에 대한 깊은 이해를 바탕으로 가장 자주 사용되는 명령어에 자동 완성을 지원합니다. 이제부터 개별 기능에 대해 살펴보겠습니다.
Eloquent
Laravel의 수많은 기능은 Eloquent를 강력한 ORM으로 만들어주며, PhpStorm은 Laravel Idea 플러그인의 도움으로 그 모든 것을 이해할 수 있습니다. 이를 통한 이점으로는 범위와 같은 메서드에 대한 자동 완성부터 사용 가능한 모든 모델 필드 및 관계에 대한 PhpStorm의 인식, 쿼리 빌더 및 팩토리에 대한 완벽한 지원 등 다양하게 있습니다.

경로 지원
이 번들은 모든 경로에 대한 자동 완성과 인사이트를 제공합니다. 즉, 사용자는 경로 이름과 경로 메서드에 대한 자동 완성 기능을 이용할 수 있습니다.

Livewire
동적 인터페이스를 획기적으로 단순화하는 라이브러리인 Livewire도 지원됩니다. 메서드와 프로퍼티에 대한 자동 완성 기능을 사용할 수 있고 뷰와 구성 요소 파일 사이를 쉽게 전환하며 구성 요소를 클릭하는 등의 작업을 수행할 수 있습니다.

요청 클래스
Laravel Idea 플러그인과 결합된 PhpStorm은 요청 클래스와 유효성 검사 규칙을 지원하므로 필요할 때 어디서든 다양한 자동 완성 및 인사이트를 추가할 수 있습니다. 모델을 기반으로 디폴트 요청 규칙을 생성할 수도 있습니다.

코드 생성
Laravel Idea는 거의 모든 것을 생성할 수 있도록 지원합니다. 컨트롤러 및 미들웨어부터 마이그레이션 및 콘솔 명령어에 이르기까지 모두 가능합니다. ‘make’ 명령어나 관련 매개변수를 기억할 필요가 없습니다. Laravel Idea는 필요한 모든 요소를 생성할 수 있는 깔끔한 인터페이스를 제공합니다.

Blade의 구문 강조 표시
PhpStorm은 이미 다양한 구문 및 구문 오류에 대한 강력한 구문 강조 표시 기능을 기본적으로 제공합니다. Laravel 장인을 위해서 Laravel의 템플릿 엔진을 통해 Blade 지원을 추가했습니다.
Blade 구성 요소로 코드를 추출할 수 있으며 해당 구성 요소에 대한 자동 완성 기능이 제공됩니다. 또한 Blade 파일 이름을 리팩터링하고 모든 참조를 자동으로 업데이트할 수 있습니다. 컨트롤러 내에서 Blade 파일을 생성하고 해당 Blade 파일 내에서 자동 완성 기능을 사용하는 등의 작업을 수행할 수도 있습니다.

네임스페이스 및 가져오기 자동 조정
자동 완성 및 강조 표시 외에도 PhpStorm에는 네임스페이스 및 가져오기 자동 조정과 관련된 강력한 기능이 다양하게 갖추어져 있습니다.
파일을 이동하면 PhpStorm이 해당 네임스페이스와 모든 가져오기를 자동으로 조정합니다. 클래스를 참조할 때 PhpStorm은 이에 대한 가져오기를 추가합니다. PhpStorm은 변수 이름 바꾸기, 별도의 메서드로 코드 추출 등과 같은 지루한 작업을 리팩터링 기능을 통해 자동으로 수행하고 오류 감지, 코드 생성, 서식 지정 지원 등을 제공합니다.

프런트엔드 프레임워크 지원
또한 PhpStorm은 Tailwind, Vue, React 등 인기 있는 프런트엔드 프레임워크를 기본적으로 지원합니다.


애플리케이션 통합
PhpStorm에는 GIT 통합(GitHub 지원 포함), HTTP 클라이언트, 디버거, 데이터베이스 도구 등 다양한 도구들이 기본적으로 포함되어 있습니다.

Jeffrey Way의 새로운 Laravel 과정
PhpStorm 및 Laravel Idea 번들이 제공하는 기능을 자세히 살펴보고 싶으신가요? 이 무료 Laracasts 온라인 과정(영어로 제공)에서 다음과 같은 내용을 배워보세요.
- PhpStorm에서 Laravel Idea 플러그인을 사용하여 코딩하면서 효과적으로 Laravel 개발을 합니다.
- PestPHP를 사용하여 코드를 리팩터링, 디버그 및 테스트합니다.
- Laravel로 더 나은 코드를 작성하고 생산성을 높입니다.
이게 전부가 아닙니다! 이제 특별 50% 할인으로 Laravel Idea 플러그인의 혜택을 누릴 수 있습니다. 여기에서 특별한 혜택을 알아보세요.
게시물 원문 작성자
Subscribe to PhpStorm Blog updates
Discover more
Laravel Best Practices: How to Automate Your Routine
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.

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

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.

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.

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.

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.

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.

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


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.

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.