Courses

[NEW] Laravel Project PROCESS: From Start to Finish

Static Analysis with Larastan

Summary of this lesson:
- Installing and configuring Larastan
- Setting up static analysis
- Fixing code quality issues
- Adding GitHub actions for Larastan

Next, we will work on another Code quality tool - Larastan.


Why Larastan is Needed?

At first glance, it does the same job as our IDE - it shows errors and warnings in the code. But Larastan is more than that.

The idea behind Larastan is to catch errors that are not visible in the code but can happen during runtime (e.g., calling a method on a non-existing model attribute).

On top of that, it also checks for compatibility issues. For example, if you have a method that should return a string, but you return an integer, Larastan will catch that.


Installing Larastan

First, we create a GitHub issue to install Larastan:

Then, we create a new branch:

git checkout -b feature/larastan

Now we can install Larastan, we run the composer command:

composer require --dev "larastan/larastan:^3.0"

Then, we need to create a configuration file for...

The full lesson is only for Premium Members.
Want to access all 16 lessons of this course? (105 min read)

You also get:

  • 69 courses (majority in latest Laravel 11)
  • Premium tutorials
  • Access to repositories
  • Private Discord