Laravel is cool and all, but does not quite provide the “out of the box” dev experience as ASP.NET or, gasp, Typescript.
Let us change that by using a few good editor tools and packages.
PHP Intelephense extension
I use VSCode and there is no better auto completion than PHP Intelephense. It is fast, reasonably accurate and provides more than few options for playing around the code.
Laravel Extra Intellisense extension
Install Laravel Extra Intellisense extension for -
- Route names and parameters
- Suggestions in middlewares
- Views
Laravel Snippets extension
Install Laravel Snippets extension for Laravel snippets.
Laravel Blade Snippets extension
Install Laravel Blade Snippets extension for Laravel Blade snippets.
Laravel IDE Helper package
Install [Laravel IDE Helper] https://github.com/barryvdh/laravel-ide-helper for better auto completion in Laravel.
|
|
Address Auto Complete Annoyances for Laravel and PHP in VSCode
When you open Laravel code, you will see autocomplete suggestions, but you will see a lot more than desired. The suggestions -
- lacks context
- has generic suggestions
There are a few things you can do -
Ctrl + Shift + p
> Go toPreferences > Open Settings (UI)
. Search foreditor.snippetSuggestions
and set it tobottom
- Next, search for
php.suggest.basic
and set it tofalse
Set Alias for php artisan
You will be typing php artisan
at least a hundred times a day - better to save all the calories by setting an alias or a shortcut.
In Powershell, open your default profile -
|
|
Enter the below to set alias to pa
-.
|
|
If you use wsl
, you would be using bash
or zsh
. Just edit your .bashrc
or .zshrc
file to add an alias.
|
|
Add the below line -
|
|
Now you can type pa
instead of php artisan
with how many ever arguments and it should work seamlessly.
Use Laravel debugbar.
Install the debugbar in your Laravel project.
|
|
Ensure your .env
file has APP_DEBUG=true
and APP_ENV=local
.
Start your Laravel server and you should see the debugbar at the bottom of the page.
See the documentation for more options.