skmirajbn's avatar

Laravel DX Pain Points: Type Hints, Model Schemas, and Migration Automation

Hey Laravel community,

I’m loving Laravel but hitting some DX snags coming from TypeScript world. Here’s what’s bugging me:

  1. No Type Autocompletion: Example User::find($id) returns User|null, but my IDE (VS Code) doesn’t warn about $user->name null errors or autocomplete properties. Socialite::driver() lacks driver suggestions too.
  2. No Model Schema: Eloquent models don’t define properties, so I’m blind on $user->name vs $user->foo without checking migrations.
  3. Manual Migrations: Writing every migration by hand is slow—Drizzle auto-generates them from a schema diff.
  4. PHP Intelephense Is Not Accurate: Many times, Intelephense provides incorrect warnings.

Why isn’t the Laravel team tackling these? PHP’s typed now, and other frameworks offer this out of the box. I wish they’d add native type hints (e.g., User::find(): User|null), a $schema in models for autocompletion, and a migrate:from-model command. It’d make Laravel’s DX killer for typed-language devs like me.

Thoughts? Hoping this gets resolved soon!

0 likes
2 replies
Tray2's avatar

There is an first party plugin for vs code, not sure if it is out of beta yet.

https://github.com/laravel/vs-code-extension

Vscode is not really an IDE so you can’t really expect it to handle all of Laravel’s syntax specialities.

I would suggest getting phpstorm and the laravel idea plugin.

RemiM's avatar

Like @tray2 mentioned it, you have the official Laravel extension available, and it's no longer a beta.

A short summary of what it can do:

  • Click through to file
  • Blade syntax highlighting
  • Autocomplete
  • Error and quick fix creation
  • Eloquent auto-complete (queries, relationships)

Official presentation of the plugin on YouTube.

Technically, you can uninstall Laravel Blade formatter and Laravel Extra Intellisence after that, or related extensions, but of course try to see what's best for you.

On a side note, even with this plugin, if you wish to have the best experience with PHP in general, and Laravel in this case, PhpStorm is the best option. It all depends on your needs.

Please or to participate in this conversation.