Skip to content

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>).

FieldRequiredDescription
pathYesPath to the components directory.
namespaceNoTag namespace prefix (e.g. "pkg" → <x-pkg::component>).
prefixNoTag prefix added after the namespace (e.g. "btn-" → <x-btn-component>).
json
{
    "$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.

FieldRequiredDescription
phpNamespaceYesPHP namespace of the component classes.
tagNamespaceNoTag namespace prefix (e.g. "pkg" → <x-pkg::component>).
prefixNoPrefix added to the tag name (e.g. "btn-" → <x-btn-component>)
ignoreBladeComponentPrefixNoIf true, the x- prefix is not added to tags. Default: false.
json
{
    "$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.

FieldRequiredDescription
configFileNameYesName of the config file (without .php), e.g. "livewire".
componentsKeyYesDot-notation key inside the config array that holds the component list.
prefixKeyNoKey inside the config entry that holds the tag prefix. Default: "prefix".
namespaceKeyNoKey inside the config entry that holds the namespace. Default: "namespace".
aliasKeyNoKey inside the component entry that holds the alias/tag name.
classFetchNoHow to extract the class name from a config entry.
viewFetchNoHow 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.

json
{
    "$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" }
                }
            ]
        }
    }
}
php
// 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.

FieldRequiredDescription
nameYesComponent tag name (without the x- prefix).
namespaceNoTag namespace.
classNameNoFQN of the component's PHP class.
json
{
    "$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.

json
{
    "$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.

FieldRequiredDescription
nameYesDirective name without @, e.g. "myDirective".
prefixNoPHP code prefix injected before the directive argument for language injection.
suffixNoPHP 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.

json
{
    "$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.

FieldRequiredDescription
nameYesDirective base name (alphanumeric only), e.g. "role".
prefixYesPHP prefix for language injection inside the condition.
suffixYesPHP suffix for language injection inside the condition.
json
{
    "$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.

FieldRequiredDescription
nameYesDirective base name (alphanumeric only).
json
{
    "$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
    "blade": {
        "scriptDirectives": [
            { "name": "script" },
            { "name": "style" }
        ]
    }
}