PHPStorm does an excellent job figuring out what type of file you're editing automatically, both by looking at the file's extension and other naming patterns. For example, SomeFile.php
will be associated with PHP, but some-view.blade.php
will also have extra niceties for Blade enabled.
In yesterday's tip, I talked about how we allow Blade rendering to work inside a Markdown file, but this approach confused PHPStorm a little bit. By default, it treats the file as Markdown, which makes sense since it's a file ending in .md
. But then none of the Blade highlighting and auto-complete works. It looks like this
On the other hand, I can right-click the file in PHPStorm's Project view, choose "Override file type" and pick "Blade template" and then it looks like this, giving me a normal Blade experience
In the end, I kept it as a normal Markdown file, since we're not using a lot of Blade features, and I can get by just typing out my route helpers without auto-complete. But this can be handy if you ever have a case where the auto-detection isn't doing the thing you want.
Here to help,
Joel
P.S. Laravel is pretty secure by default, but Aaron published a course to go even deeper on Laravel security.