Description
We use a lightweight Twig component model on top of TwigBridge. Each component
class declares its template via a static method returning the view name; the
actual view() call happens later inside a central Twig extension:
class Header implements TwigComponent
{
public static function template(): string
{
return 'components/corporate/header'; // ← view name, but not recognized
}
}
// elsewhere, in the Twig extension:
return view($componentClass::template(), $context)->render();
Since the string literal is not an argument of view() / View::make(),
Laravel Idea does not recognize it as a view reference — no completion,
no click-navigation to the template, no "unresolved view" inspection,
and the template file itself is reported as unused.
What we tried
ide.json completions with "complete": "views" — works only for method
arguments, not for return values.
- Current workaround:
return view('components/corporate/header')->name();
— the literal becomes visible to Laravel Idea, at the cost of instantiating
a View object at runtime (we cache the resolved name per request).
Proposal
Any of these would solve it:
ide.json support for marking a method's return value as a view
reference, e.g. "place": "returnValue" in a completion definition;
- or an attribute the plugin recognizes, e.g.
#[ViewName] on the method /
a class-level #[View('components/...')];
- or recognizing view-name strings returned from methods implementing a
configurable interface.
This would also help other "registry" patterns where view names live in
constants/config arrays rather than direct view() calls.
Plugin version: Laravel Idea 13.2.0.261
PhpStorm version: PhpStorm 2026.1.3 (PS-261.25134.104)
Description
We use a lightweight Twig component model on top of TwigBridge. Each component
class declares its template via a static method returning the view name; the
actual
view()call happens later inside a central Twig extension:Since the string literal is not an argument of
view()/View::make(),Laravel Idea does not recognize it as a view reference — no completion,
no click-navigation to the template, no "unresolved view" inspection,
and the template file itself is reported as unused.
What we tried
ide.jsoncompletionswith"complete": "views"— works only for methodarguments, not for return values.
return view('components/corporate/header')->name();— the literal becomes visible to Laravel Idea, at the cost of instantiating
a
Viewobject at runtime (we cache the resolved name per request).Proposal
Any of these would solve it:
ide.jsonsupport for marking a method's return value as a viewreference, e.g.
"place": "returnValue"in a completion definition;#[ViewName]on the method /a class-level
#[View('components/...')];configurable interface.
This would also help other "registry" patterns where view names live in
constants/config arrays rather than direct
view()calls.Plugin version: Laravel Idea 13.2.0.261
PhpStorm version: PhpStorm 2026.1.3 (PS-261.25134.104)