Question: Intellisense for Laravel helper methods

Author: saadeCreated Oct 22, 2024Updated Feb 4, 2026
Labelsquestion

Versions:

  • ide-helper Version: v3.1.0
  • Laravel Version: 11.28.1
  • PHP Version: 8.3.11

Question:

When defining a macro, let's say for the Response class:

php
// app/Providers/AppServiceProvider.php

use Illuminate\Support\Facades\Response;

Response::macro('api', function (?string $message = null, ?array $data = null, int $status = 200, array $headers = []) {
    return Response::json(
        data: ['message' => $message, 'data' => $data],
        status: $status,
        headers: $headers
    );
});

is it possible to get intellisense when using? :

php
return response()->api() // Undefined method 'api'

This also occurs when macroing Auth too:

php
use Illuminate\Support\Facades\Auth;

Auth::macro('admin', function (): ?Admin {
    /** @var Auth $this */
    return auth('admin')->user();
});
php
auth()->admin() // Undefined method 'admin'

PS: The method works as expected, just the intellisense cannot pick the defined macro PS2: Even auth()->user() which is a standard method is not being found

Source: barryvdh/laravel-ide-helper