Skip to content

ide.json: Helper Code

Overview

The helperCode section controls how Laravel Idea generates its internal helper code — the phantom PHP file that gives the IDE type information for dynamic Laravel patterns.

helperCode.eloquent

Controls which Eloquent models are included in helper code generation.

eloquent.ignoreClasses

A list of fully qualified class names that should be excluded from Eloquent helper code generation.

json
{
    "$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
    "helperCode": {
        "eloquent": {
            "ignoreClasses": [
                "\\MyPackage\\BaseModel",
                "\\MyPackage\\TenantModel"
            ]
        }
    }
}

eloquent.ignoreNamespaces

A list of PHP namespaces. All Eloquent models inside these namespaces will be excluded from helper code generation.

json
{
    "$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
    "helperCode": {
        "eloquent": {
            "ignoreNamespaces": [
                "\\MyPackage\\Models"
            ]
        }
    }
}

helperCode.methodsWithConstructorParameters

Registers methods that accept the same parameters as a class constructor. This is the pattern used by dispatch(), Bus::dispatch(), and similar helpers — the method's signature mirrors the constructor of the class passed as an argument.

Laravel Idea will expose those constructor parameters as if they were the method's own parameters, enabling proper type-checking and completion.

FieldRequiredDescription
baseFqnYesFQN of the base class/interface/trait whose inherit class methods should be enhanced.
methodsYesArray of method definitions.

Each method:

FieldRequiredDescription
nameYesMethod name.
returnTypeYesFQN of the return type.
additionalParametersNoExtra parameters added before the constructor parameters.

Each additional parameter:

FieldRequiredDescription
nameYesParameter name.
typeYesPHP type (FQN or primitive).
json
{
    "$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
    "helperCode": {
        "methodsWithConstructorParameters": [
            {
                "baseFqn": "\\MyPackage\\Bus",
                "methods": [
                    {
                        "name": "dispatch",
                        "returnType": "\\MyPackage\\PendingDispatch"
                    },
                    {
                        "name": "dispatchAfterResponse",
                        "returnType": "\\MyPackage\\PendingDispatch",
                        "additionalParameters": [
                            { "name": "delay", "type": "int" }
                        ]
                    }
                ]
            }
        ]
    }
}

For this example, if the class is extended from the \MyPackage\Bus class and has a constructor __construct(string $name), two methods will be generated in the helper code: dispatch(string $name) and dispatchAfterResponse(int $delay, string $name).

helperCode.classMixins

Adds a @mixin annotation to a class in the helper code, giving it all the methods and properties from another class. Useful when a package dynamically extends a class via macros or traits that the IDE cannot detect statically.

FieldRequiredDescription
classFqnYesFQN of the class to receive the mixin.
mixinFqnYesFQN of the class whose members are mixed in.
json
{
    "$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
    "helperCode": {
        "classMixins": [
            {
                "classFqn": "\\Illuminate\\Http\\Request",
                "mixinFqn": "\\MyPackage\\RequestMacros"
            }
        ]
    }
}

After this, all public methods and properties from \MyPackage\RequestMacros will be available on \Illuminate\Http\Request in the IDE.