ide.json: Blade
Overview
The blade section configures Blade-specific features: component sources, custom directives, custom if-directives, and custom script directives.
blade.components
Configures where Laravel Idea looks for Blade components. There are four ways to define component sources, and they can be combined freely.
components.viewPaths
Registers directories that contain anonymous Blade components (.blade.php files used as <x-component-name>).
| Field | Required | Description |
|---|---|---|
path | Yes | Path to the components directory. |
namespace | No | Tag namespace prefix (e.g. "pkg" → <x-pkg::component>). |
prefix | No | Tag prefix added after the namespace (e.g. "btn-" → <x-btn-component>). |
{
"$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
"blade": {
"components": {
"viewPaths": [
{
"path": "/resources/views/components/forms",
"prefix": "form"
}
]
}
}
}components.phpNamespaces
Registers PHP namespaces that contain class-based Blade components.
| Field | Required | Description |
|---|---|---|
phpNamespace | Yes | PHP namespace of the component classes. |
tagNamespace | No | Tag namespace prefix (e.g. "pkg" → <x-pkg::component>). |
prefix | No | Prefix added to the tag name (e.g. "btn-" → <x-btn-component>) |
ignoreBladeComponentPrefix | No | If true, the x- prefix is not added to tags. Default: false. |
{
"$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
"blade": {
"components": {
"phpNamespaces": [
{
"phpNamespace": "\\MyPackage\\View\\Components",
"tagNamespace": "my-pkg"
}
]
}
}
}components.fromConfig
Loads component definitions from a Laravel config file. Useful when a package registers its components dynamically via config.
| Field | Required | Description |
|---|---|---|
configFileName | Yes | Name of the config file (without .php), e.g. "livewire". |
componentsKey | Yes | Dot-notation key inside the config array that holds the component list. |
prefixKey | No | Key inside the config entry that holds the tag prefix. Default: "prefix". |
namespaceKey | No | Key inside the config entry that holds the namespace. Default: "namespace". |
aliasKey | No | Key inside the component entry that holds the alias/tag name. |
classFetch | No | How to extract the class name from a config entry. |
viewFetch | No | How to extract the view name from a config entry. |
classFetch and viewFetch each have a type field ("string", "arrayKey", or "empty") and an optional key field for "arrayKey" type.
{
"$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
"blade": {
"components": {
"fromConfig": [
{
"configFileName": "my-package",
"componentsKey": "components",
"classFetch": { "type": "arrayKey", "key": "class" },
"viewFetch": { "type": "arrayKey", "key": "class" }
}
]
}
}
}// config/my-package.php
return [
'components' => [
'alert' => [
'class' => 'MyPackage\Components\Alert',
'view' => 'my-package::components.alert',
],
'badge' => [
'class' => 'MyPackage\Components\Badge',
'view' => 'my-package::components.badge',
],
],components.list
Registers individual components by name, without scanning any directory or config.
| Field | Required | Description |
|---|---|---|
name | Yes | Component tag name (without the x- prefix). |
namespace | No | Tag namespace. |
className | No | FQN of the component's PHP class. |
{
"$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
"blade": {
"components": {
"list": [
{ "name": "alert", "className": "\\MyPackage\\Components\\Alert" },
{ "name": "badge", "namespace": "pkg" }
]
}
}
}components.ignoreViewPaths
A list of paths that should be excluded from Blade component scanning. Useful when a directory is picked up by the default scanner but should not be treated as a component source.
{
"$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
"blade": {
"components": {
"ignoreViewPaths": [
"/resources/views/emails"
]
}
}
}blade.directives
Registers custom Blade directives so the IDE recognizes them instead of marking them as unknown.
| Field | Required | Description |
|---|---|---|
name | Yes | Directive name without @, e.g. "myDirective". |
prefix | No | PHP code prefix injected before the directive argument for language injection. |
suffix | No | PHP code suffix injected after the directive argument. |
When both prefix and suffix are provided, Laravel Idea enables PHP language injection inside the directive's parentheses.
{
"$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
"blade": {
"directives": [
{ "name": "myDirective" },
{
"name": "injectExpr",
"prefix": "<?php echo (",
"suffix": "); ?>"
}
]
}
}blade.ifDirectives
Registers custom if-style directives. For a directive named "role", Laravel Idea will recognize @role(), @elserole, @unlessrole, and @endrole.
All three fields are required. prefix and suffix define the PHP injection context for the condition expression.
| Field | Required | Description |
|---|---|---|
name | Yes | Directive base name (alphanumeric only), e.g. "role". |
prefix | Yes | PHP prefix for language injection inside the condition. |
suffix | Yes | PHP suffix for language injection inside the condition. |
{
"$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
"blade": {
"ifDirectives": [
{
"name": "role",
"prefix": "<?php if(auth()->user()->hasRole(",
"suffix": ")): ?>"
}
]
}
}This makes the IDE understand @role('admin') ... @endrole as a proper if-block.
blade.scriptDirectives
Registers custom script-block directives. For a directive named "script", Laravel Idea will recognize @script and @endscript as a paired block.
| Field | Required | Description |
|---|---|---|
name | Yes | Directive base name (alphanumeric only). |
{
"$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
"blade": {
"scriptDirectives": [
{ "name": "script" },
{ "name": "style" }
]
}
}