logo

Want full IDE support when editing stub files?

Here's a quick config for PHPStorm

Joel Clermont
Joel Clermont
2026-01-19

Laravel uses .stub files for generating code. By default, PhpStorm doesn't treat them as PHP. This means you don't get any syntax highlighting, code completion, or error detection.

Here's how to fix it:

  • Right-click the .stub file in the project explorer.
  • Choose "Override File Type..."
  • In the dialog that appears, select "PHP"

This will tell PhpStorm to treat just this one stub file as PHP, not all stub files. Repeat the process for any other stub files you want to edit with full PHP syntax support.

This is especially useful when customizing Laravel's default stubs (php artisan stub:publish) or one of your package's stubs.

It's not something I need every day, but these small quality of life improvements make editing stubs much more pleasant when I need it.

Here to help,

Joel

P.S. Do you have a tip to share for your favorite editor? This would be a great thing to bring to our monthly community dev call.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼
email
No spam. Only real-world advice.